I have a listview
ListView poiList = (ListView) findViewById(R.id.poiList);
and im populating it with
SimpleAdapter adapter = new SimpleAdapter(this, data,
android.R.layout.simple_list_item_2,
new String[] {"name", "dist"},
new int[] {android.R.id.text1,
android.R.id.text2});
poiList.setAdapter(adapter);
With this SimpleAdapter, there's an item and a subitem for each row in the ListView. Everything works perfectly.
Now I implement onItemClick for my ListView:
poiList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
String poiName = ((TextView)view).getText().toString();
}
}
But I cant get the text in the row that I selected. I think There's more than a single TextView in that row ( Item and subitem). How can I refer to them?