long-click

android maps: How to Long Click a Map?

不羁岁月 提交于 2019-11-27 11:23:01
How do I long click on a mapview so that a place marker appears at that point on the map? I tried a couple ways without success: 1) Using setOnLongClickListener on the MapvView which never detected the longclicks. 2) My other idea was to extend MapView to override dispatchTouchEvent .. Create a GestureDetector to respond to longpress callback. But I was stuck midway here as I could not get a handle to my subclassed Mapview. i.e. MyMapview mymapview; //MyMapView extends MapView //results in a classcast exception mymapView = (MyMapView) findViewById(R.id.map); 3) The only other way I know how to

creating a menu after a long click event on a list view

半腔热情 提交于 2019-11-27 10:36:14
I have a list view connected to a database, showing a all the entries. I want a menu to show up if the user long clicks a item in the listview(database entry), showing options to edit or delete the entry. how can i do this. Till now, I have tried using a onItemLongClick listener and a toast in it showing the id of the view long clicked. @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { String res = Long.toString(id); Toast toast = Toast.makeText(this, res, Toast.LENGTH_SHORT); toast.show(); return true; } 7bluephoenix Instead of using

How do you implement context menu in a ListActivity on Android?

一个人想着一个人 提交于 2019-11-27 10:34:18
How do you implement a context menu triggered by a long click or tap on a ListActivity that is using the built in layouts and a ListAdapter? pupeno On the onCreate method call registerForContextMenu like this: registerForContextMenu(getListView()); and then populate the menu on onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) . The menuInfo argument can provide information about which item was long-clicked in this way: AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { Log.e(TAG, "bad

Android - Is It possible to disable the long click of home button to avoid the task manager?

被刻印的时光 ゝ 提交于 2019-11-27 02:50:41
问题 I am looking for a way to disable the task manager window once I long press on the home button. I managed to disable other device keys (such as volume, menu etc) and the normal click on the home button as I am the default launcher, but I don't know how to disable the task manager! Even Toddler Lock kids app show u the task manager screen following long click, so I assume it isn't easy to do so. I saw few answers say I shouldn't disable the task manager, but I want to have it from another key

How do you implement context menu in a ListActivity on Android?

浪子不回头ぞ 提交于 2019-11-26 17:57:20
问题 How do you implement a context menu triggered by a long click or tap on a ListActivity that is using the built in layouts and a ListAdapter? 回答1: On the onCreate method call registerForContextMenu like this: registerForContextMenu(getListView()); and then populate the menu on onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo). The menuInfo argument can provide information about which item was long-clicked in this way: AdapterView.AdapterContextMenuInfo info; try { info

android maps: How to Long Click a Map?

こ雲淡風輕ζ 提交于 2019-11-26 15:32:31
问题 How do I long click on a mapview so that a place marker appears at that point on the map? I tried a couple ways without success: 1) Using setOnLongClickListener on the MapvView which never detected the longclicks. 2) My other idea was to extend MapView to override dispatchTouchEvent .. Create a GestureDetector to respond to longpress callback. But I was stuck midway here as I could not get a handle to my subclassed Mapview. i.e. MyMapview mymapview; //MyMapView extends MapView //results in a

creating a menu after a long click event on a list view

限于喜欢 提交于 2019-11-26 15:15:02
问题 I have a list view connected to a database, showing a all the entries. I want a menu to show up if the user long clicks a item in the listview(database entry), showing options to edit or delete the entry. how can i do this. Till now, I have tried using a onItemLongClick listener and a toast in it showing the id of the view long clicked. @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { String res = Long.toString(id); Toast toast = Toast

Detecting a long press with Android

蓝咒 提交于 2019-11-26 01:47:13
问题 I am currently using onTouchEvent(MotionEvent event){ } to detect when the user presses my glSurfaceView is there a way to detect when a long click is made. I\'m guessing if I can\'t find much in the dev docs then it will be some sort of work around method. Something like registering ACTION_DOWN and seeing how long it is before ACTION_UP. How do you detect long presses on android using opengl-es? 回答1: Try this: final GestureDetector gestureDetector = new GestureDetector(new GestureDetector