Locations のリストを含む Track オブジェクトの値を入力する展開可能なリスト ビューがあります。それはうまくいきます。ただし、私の TextView.setText は、各 textView に Locations のリストの LAST 値を入力しています。
どうすればこれを修正できますか?
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_child_item_layout, null);
for (Location loc : trackList.get(groupPosition).getLocations()) {
//Log.i(MY_EXPANDABLELIST_ACTIVITY_TAG, "Location X: " + loc.getLongitude());
TextView textLongitude = (TextView) convertView.findViewById(R.id.textView_longitude);
textLongitude.setText("Longitude: " + Double.toString(loc.getLongitude()));
TextView textLatitude = (TextView) convertView.findViewById(R.id.textView_latitude);
textLatitude.setText("Latitude: " + Double.toString(loc.getLatitude()));
TextView textAltitude = (TextView) convertView.findViewById(R.id.textView_altitude);
textAltitude.setText("Altitude: " + Double.toString(loc.getAltitude()));
TextView textSpeed = (TextView) convertView.findViewById(R.id.textView_speed);
textSpeed.setText("Speed: " + Float.toString(loc.getSpeed()));
TextView textAccuracy = (TextView) convertView.findViewById(R.id.textView_accuracy);
textAccuracy.setText("Accuracy: " + Float.toString(loc.getAccuracy()));
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.ENGLISH);
Date date = new Date(loc.getTime());
String formattedDate = format.format(date);
TextView textTime = (TextView) convertView.findViewById(R.id.textView_time);
textTime.setText("Time: " + formattedDate);
}
}
return convertView;
}
値は LogCat で正しいです。