I can’t get name of ListView item by click. I fill data from database with SimpleCursorAdapter, and when I click on item I want to get item name, but I recive data like this
android.content.ContentResolver$CursorWrapperInner@4054b988.
How I can get text from it?
There is m click listener:
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Object object = this.getListAdapter().getItem(position);
String item = object.toString();
Log.i( TAG, "Name: " + item );
}
Actually you got what you’ve called. Every object has a default
toString()method which will return a String describe its class name and position in memory and that’s the result you got there. You have to override this method to have a meaningful return value. For example, by castingObjectto a meaningful object of your own