I have listview that binds from sqlite and groups by KEY_TITLE(field) so i need to get the name of the item that is clicked
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
Intent i=new Intent(this,detail.class);
i.putExtra(DatabaseIN.KEY_TITLE,SOMETHING THAT I NEED!);
//startActivity(i);
startActivityForResult(i,ACTIVITY_EDIT);
}
// maybe something like this string selectedIteme = l.getSelectedItem().getSOMETNIG?
check this tutorial might help you http://www.vogella.de/articles/AndroidListView/article.html
you can pick the selected item value like this
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Cursor c = (Cursor) arg0.getAdapter().getItem(arg2);
Intent i=new Intent(getApplicationContext(),Xyz.class);
i.putExtra("abc", c.getString(1));
startActivity(i);
}
Try this in your onClick method..
Map<String, String> selection = (Map<String, String>) listView.getItemAtPosition(position);
String count = selection.get("count");
String title = selection.get("title");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With