Wednesday, April 27, 2011

[android-developers] Calling menu from an item in a ListView

Hi,
I have a ListView, that exibits data from my database.
What I want to do, is to click on the item from the ListView and call
the Menu.

The Menu is called normally if I click on the menu button in the
phone.
But I couldnt find a way to call the menu since I click on one item
from the ListView.

final ListView listProfile =
((ListView)findViewById(R.id.lvListView));
listProfile.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> adapter, View view, int
position, long id){
idRow = position; //t
WHAT I WOULD LIKE TO DO IS CALL THE
onCreateOptionsMenu HERE!!!!
THAT MEANS, WHEN o CLICK ON THE ITEM IN THE ListView
}
});

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}

Any idea how to do that?
thanks

P.s. - using api 2.2 level 8

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment