android - How to set onContextItemClickListener for a context menu of ListView? -


I use the following code to set up the context menu for your listview now I make onContextItemClickListener to the context menu Want to Apparently there is no such method like listview.setOnContextItemClickListener Please help me here.

view list view list = new list view (getApplicationContext ()); @SuppressWarnings ( "unchecked") Arreadptr Suchiwuareaadetr = new Arreadaptr (getApplicationContext (), android.R.layout.simple_list_item_1, location); ListView.setAdapter (listViewArrayAdapter); ListView.setFocusableInTouchMode (true); listView.setOnFocusChangeListener (New View.OnFocusChangeListener () {@Override public void onFocusChange (see arg0, Boolean ARG1) {Log.i ( "SampleApp", "onFocusChanged () - view =" + arg0);}}); listView.setOnItemClickListener (New AdapterView.OnItemClickListener () {@Override public void onItemClick (AdapterView adapterView, to see integer ARG2, long arg3) {int selectedPosition = adapterView.getSelectedItemPosition (); Log.i (the "SampleApp" " Click status "+ selected position";}}); ListView.setOnCreateContextMenuListener (New View.OnCreateContextMenuListener () {Public Waste PertainText Menu (context menu menu, view view reference menu.contact menuinfo menuinfo) {AdapterContentMenfoMy = (AdapterCont MenuMinfoInfo (0, 0, 0, "remove");}});

You should add:

  // Register for the context menu registerForrentx menu (LV);  

To register for (ie LIVE list is an example of Week) and then:

  // This method is called when the user selects an item Context menu @Onrride Public Boolean On Conte EXtim selected (menu items) {int itemId = item.getItemId (); // Your argument is right here; }  

Hope you want this. PS: If you are interested, then I write a post about it,


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -