hello i want to implement favorite function on my context menu . my problem is i dont know how i can fetch the value of the selected context menu to be inserted to my sqlite database. .Based on this code i am able to get the position of the selected item i want to insert but i dont know how i can use that position i fetch to insert in my dbase .
`AdapterContextMenuInfo info =(AdapterContextMenuInfo)item.getMenuInfo();
itemPos = info.position;
ContentValues values = new ContentValues();
switch (item.getItemId()) {
case R.id.addtofavorites:
values.put("_id",item);
}
Toast.makeText(getBaseContext(), "Added to Favorites"+itemPos, Toast.LENGTH_SHORT).show();`
Aucun commentaire:
Enregistrer un commentaire