• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Adding to favorites

bscarl88

Lurker
I have a tab widget with 3 tabs, each with a listview inside. I setup a context menu so that when I click and hold on one of the list items it brings up a box saying add to favorites. The problem is, I don't know how to pass the selected listview item to the ArrayList in Favorites, or receive it in Favorites class. I have tried bundling and putExtra but I can't get them to work, I am pretty new to all this and even after reading many guides, I am not very good but here is the code for my context menu so far (after I deleted the messy code I tried before).

Code:
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) 
	{
	    super.onCreateContextMenu(menu, v, menuInfo);
	    menu.add(0, FAV_ID, 0, R.string.fav_insert);
	}
	public boolean onContextItemSelected(MenuItem item, View v) 
	{
		int position = 0;
	    switch(item.getItemId()) 
	    {
	    case FAV_ID:
	    	
	        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
	        //TODO add the code that adds the selected list item to the favorites class.
	        return true;
	    }
	    return super.onContextItemSelected(item);
	}

I have the ArrayList publicly declared in my Favorites class

any help would be appreciated
 
Back
Top Bottom