Hello I am a beginner in android programming. I have this recipe app with sqlite database. I am already done making the context menu with add to favorites on it. My problem is that I do not know how I to put the selected recipe to my dbase table named "favorites".. based on the TOAST. I am already getting the position of the listview.
@SuppressLint("ShowToast")
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
AdapterContextMenuInfo info =(AdapterContextMenuInfo)item.getMenuInfo();
itemPos = info.position;
ContentValues values = new ContentValues();
switch (item.getItemId()) {
case R.id.addtofavorites:
Toast.makeText(getBaseContext(), "Added to Favorites"+itemPos, Toast.LENGTH_SHORT).show();
return true;
default:
return super.onContextItemSelected(item);
}
}
Aucun commentaire:
Enregistrer un commentaire