let me c if i can help u.

@Override
    protected void onCreateContextMenu(ContextMenu menu) {
    super.onCreateContextMenu(menu);
    menu.setHeaderTitle("Message Menu");
    menu.add("Open ");
    menu.add("Reply");
    menu.add("Delete ");
    menu.add("Close Menu");
    }

public void <your function>(){
<your activity>.registerForContextMenu(<your view>);
    <your activity>.openContextMenu(<your view>);
}


hope it helps.
P.S. :
openContextMenu(View view) can be overridden in an activity only....


On Sat, Jul 18, 2009 at 2:07 PM, Georgios Galyfos <[email protected]> wrote:

> Thanks again for the reply! I think you have misunderstood what I am trying
> to do though..I am using context menus in all my screens and they all work
> OK. The onCreateContextMenu does get called and then the context menu opens
> normally...
>
> However, my question is how do I prepare the context menu if I want to call
> the openContextMenu() and open the context menu programmatically myself. In
> this case the system does not call the onCreateContextMenu for you :)
>
> I really appreciate your replies Peli, if you know how to solve this please
> let me know..thanks again!
>
>
>
> On Sat, Jul 18, 2009 at 1:40 AM, Peli <[email protected]> wrote:
>
>>
>> No, you should not call onCreateContextMenu by yourself.
>> It will be called by the system for you.
>>
>> You just need to override this function, and wait until it is called.
>>
>> Peli
>> www.openintents.org
>>
>> On Jul 17, 10:41 pm, Georgios Galyfos <[email protected]> wrote:
>> > Hi and thanks for the reply.
>> >
>> > To be honest I had this idea myself, but I didn't know what to pass as
>> > parameters to this method:
>> >
>> >                       onCreateContextMenu(ContextMenu menu, View v,
>> >                                 ContextMenuInfo menuInfo)
>> >
>> > any ideas??
>> >
>> > On Fri, Jul 17, 2009 at 6:31 PM, Peli <[email protected]> wrote:
>> >
>> > > onCreateContextMenu() should be called before the context menu is
>> > > displayed.. so this would be the place to set whatever you want to
>> > > set.
>> >
>> > > Peli
>> > >www.openintents.org
>> >
>> > > On Jul 17, 4:28 pm, Georgios Galyfos <[email protected]> wrote:
>> > > > Hi,
>> >
>> > > > I am using openContextMenu() when someone clicks on an item of a
>> list
>> > > (not
>> > > > when they long press as usual). The context menu does appear,
>> however, it
>> > > > shows the context menu for the last item that the context menu had
>> > > appeared.
>> > > > For example, if I long press the item C of the list then the context
>> menu
>> > > > for item C appears, and later if I click on item B, with
>> > > openContextMenu()
>> > > > the context menu for item C will again appear, not for B that I was
>> > > > expecting.
>> >
>> > > > How can I set the current item for which the context menu will
>> appear to
>> > > be
>> > > > the item of the list the user clicks on? I do have the position from
>> > > > onListItemClick() and I was trying to find a call like
>> > > setContextMenuItem()
>> > > > or something, but I can't find anything
>> >
>> > > > Any help would be appreciated!!!
>> >
>> > > > Thanks in advance!!
>>
>>
>
> >
>

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

Reply via email to