ContextMenu for WebView

by hkrebs » Wed, 14 Apr 2010 03:35:21 GMT


Sponsored Links
 servas,

i tried to implement a context menu for a webview, but could not
succeed, although my code works for buttons. i could not google any
useful source snippets, so it came in mind, that contextmenu's for
webview do not work???

i tried the following code:
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  WebView webview = new WebView(this);
  setContentView(webview);
  webview.setOnCreateContextMenuListener(new
OnCreateContextMenuListener() {
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
      menu.add(0, 1, 0, "TEST1");
      Log.d("TEST","CONTEXT1");
    }
  });
  webview.loadData(sHTML, "text/html", "utf-8");
}

does anyone have a working example of a contextmenu for webviews?????

a workaround i've found is webview.setOnTouchListener, and upon
MotionEvent.ACTION_UP I'm displaying a dialog. this is working, but
not a very fine method ...

ciao
  H.

--



Other Threads

1. [WTA] Samsung Galaxy Tab CDMA

Samsung Galaxy Tab keluaran Sprint (versi CDMA), system inject atau Ruim ya?
Tertarik nih kalau bisa pakai Smart EVDO Rev-A :D

Cara untuk unlock nya gampang nggak ya?
Setahu ane kalau dapet dari eBay kan locked.

Thank you infonya....

*************
Deska Affif
088-1100-GAYA (4292) | Y!: GadgetGaya
www.gadgetgaya.com  |  Bikin Gadgetmu Makin Gaya!

-- 
===============
"

2. StageFright - Seems like HTTPStream mHTTP in NuHTTPDataSource is not allocated/constructed

I see no constructor for this field in NuHTTPDataSource.
Used in AwsamePlayer finishSetDataSource_l
Thanks
Danny

-- 

3. Porting Android on MTK6516

4. WTH: Galaxy Tab ada pesan downloading 鈥

5. Samsung Galaxy Tab CDMA

6. F

7. using getSurfaceFrame to get display width/height?