I have a CustomAdapter with two textviews. I need to grab the value/string of each.
I can grab the first one by doing this:
List<String> dataList;
List<String> catList;
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long id) {
firstTextView = dataList.get(arg2); // This grabs TextView #1
secondTextView = catList. ???
// later on
adapter = new SearchAdapter(SearchableActivity.this, dataList, catList);
setListAdapter(adapter);
How do I get the second value? I can’t create an arg3 obviously
Any ideas?
Edit: Or is this not doable for ArrayAdapter and I need to create something more custom with, say, BaseAdapter?
Use the second parameter of the
onItemClickmethod:Maybe it would be better to just return a special object from your adapter that incorporates the two strings like:
and return this from this adapter.