android - How can I set an on onListItemLongClick to list from database? -


I want to show that layout in which (edit and delete) so that when users long click But an item from the list will get a dialogue to choose what he wants to delete or edit this item How can I do this? And thinks that

  Expands the public class MissionAct list {Personal DbaseManager data source; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.addmission_activity); Datasource = new database manager (this); Datasource.open (getBaseContext ()); & Lt; Missions & gt; Value = datasource.get alamimation (); ArrayAdapter & LT; Missions & gt; Adapter = new array adapter & lt; Mission & gt; (This, android.R.layout.simple_list_item_1, value); SetListAdapter (adapter); . This.getListView () setLongClickable (true); . This.getListView () setOnItemLongClickListener (New OnItemLongClickListener () {public boolean onItemLongClick (AdapterView & LT ;? & Gt; adpter, View v, int position, long id) {dialog dialog = new dialog (getBaseContext ()); dialog.setContentView (R.layout.dialg); dialog.setTitle ("nue point"); show dialog (); true back;}}); }}  

and error log

  04-29 13: 42: 45.048: E / Babel (31576): canonicalizeMccMnc: invalid mccmnc nullnull 04 -29 13: 42: 46.067: E / dlvvikvik (31611): 'android.app.AppOpsManager' class referenced from the Law box could not be searched. 04-29 13: 42: 46.9 57: E / Cell Locations (30121): Create GSMCL Place 04-29 13: 42: 47.412: E / Activity Manager (245): Mt.proff entry can not be found! 04-29 13: 42: 47.412: E / ActivityManager (245): java.io.FileNotFoundException: / proc / mtprof / position: ENOENT 04-29 (No such file or directory) 13 :: 42: 47.412: failed Open E / ActivityManager (245): 42 :: 47.412: E / ActivityManager (245): libcore.io.IoBridge.open (IoBridge.java:448) 04-29 13. Java.io.phileInputStream at & lt; Init & gt; (FileInputStream Java: 78) 04-29 13: 42: 47.412: E / ActivityManager (245): java.io.FileInputStream at & lt; Init & gt; (FileInputStream.java:105) 04-29 13:. 42: 47.412: 04-29 E / ActivityManager (245): com.android.server.am.ActivityRecord.mtProf (ActivityRecord.java:852) 13: 42: 47.412: E / ActivityManager (245): com.android. .windowsDrawn on server.am.ActivityRecord (ActivityRecord.java:653) 04-29 13: 42: 47.412: e / ActivityManager (245): $ Token.windowsDrawn (ActivityRecord.java on com.android.server.am.ActivityRecord: 225) 04-29 13: 42: 47.412: E / Activity Manager (245): at com.android.server.wm. Windows Manager Services $ H. Hndlmosej (Vindomanejrsistmkjawa: 69 9 4) 04-29 13:42:47 0,412 E / ActivityManager (245): On android.os.Handler.dispatchMessage (Handler.java:99) 04-29 13: 42: 47.412 : E / ActivityManager (245): at android.os.Looper.loop (Looper.java:154) 04-29 13: 42: 47.412: com.android at E / ActivityManager (245): 04-29 13:42. server.wm.WindowManagerService $ WMThread.run (WindowManagerService.java:754): 47.412: e / activity Manager (245) generated by: LibcorekiokErrnoException: open failed: ENOENT (No such file or directory)  

you can apply it like this;

  this.getListView () SetLongClickable (true); This.getListView () SetOnItemLongClickListener (New OnItemLongClickListener) {public boolean onItemLongClick (adapterview  

And you can use the index state to use the list element.


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 -