Hi all,

I'm trying to add custom menu items in a WebView Context Menu.
Unfortunately, my items are shown in the menu of the first web page I
load , but then if I load a second page, a long press only shows the
standard context menu items. Mine are gone.

I've put a Toast inside the code and it is displayed as well on the
first loaded page, but not on the second.

I'm using the code below :

        @Override
        public void onCreateContextMenu(ContextMenu menu, View v,
                        ContextMenuInfo menuInfo) {
                contextMenu=menu;

                Toast.makeText(this, "getpicturefromweb", 
Toast.LENGTH_LONG).show();

                MenuItem menuItem=contextMenu.add("getpicturefromweb");
                menuItem.setEnabled(true);
                menuItem.setIcon(R.drawable.icon);

                super.onCreateContextMenu(menu, v, menuInfo);
        }

I think the context menu is repopulated depending on what you
longpress(link, image, ...) and I didn't find the correct hook.

I've read about a OnPopulateContextMenuListener hook, but I get a
unresolved import when I try to add it. Maybe it's deprecated but I
don't know I could not find it in the Api docs.

Last and not least, if someone knows how to solve the avobe, I'd like
to know if it's possible in some way to add my item only on specific
objects ?
Like a "Use this picture" on a picture.

Thanks in advance.

Yahel

-- 
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