long-click

Android - Why does onItemLongClick(…) return a boolean?

穿精又带淫゛_ 提交于 2019-12-04 15:36:05
问题 Coming from a Java background I am used to dealing with actions though I'm not really sure why the method requires a boolean is returned and don't fully understand the explanation given on the site: true if the callback consumed the long click, false otherwise. 回答1: As you may know, the View hierarchy in Android is represented by a tree. When you return true from the onItemLongClick() - it means that the View that currently received the event is the true event receiver and the event should

Can angular's ngTouch library be used to detect a long click (touch/hold/release in place) event?

ぃ、小莉子 提交于 2019-12-04 05:25:34
My AngularJS app needs to be able to detect both the start and stop of a touch event (without swiping). For example, I need to execute some logic when the touch begins (user presses down their finger and holds), and then execute different logic when the same touch ends (user removes their finger). I am looking at implementing ngTouch for this task, but the documentation for the ngTouch.ngClick directive only mentions firing the event on tap. The ngTouch.$swipe service can detect start and stop of the touch event, but only if the user actually swiped (moved their finger horizontally or

horizontal menu inflater on long click for web view

一曲冷凌霜 提交于 2019-12-04 03:15:32
问题 Hy, I am having a problem with the webview selection on longClick. I already had an implementation of a customized menu that launches on longClick. But the default menu is launching as well. I am trying to customize the default menu, but I'm not knowing how to capture the click of the user on an item. I have tried the following, but the menu is becoming vertical and hiding the selection, so I cannot select more words or change the selection. @Override public void onCreateContextMenu

ActionbarSherlock: Long-click on action item show a Toast?

眉间皱痕 提交于 2019-12-03 13:56:59
问题 When an action item is long-clicked, a Toast without text is show below the action item. Can I disable the Toast ? Thanks you. 回答1: If you omit a title or specify that the action item should be displayed with text then long-pressing will not toast. Otherwise the toast adds clarification of what each action item represents. 回答2: Using this answer to get the action bar view: https://stackoverflow.com/a/21125631/555914 I used this to disable the toast: View actionBar = AppUtils.getActionBarView

Long click on ListFragment

旧城冷巷雨未停 提交于 2019-12-03 10:32:28
问题 I'm working with a ListFragment and doing a onListItemClick. Everything works fine, but now I want to use a long Item Click (e.g setOnItemLongClickListener(new OnItemLongClickListener() for an Activity). How can I use this in my fragment? Thanks! 回答1: Yes, the solution posted by tsync works for me. I too had ran into same problem and considered that this is not possible. I tried the above suggestion as follows: public class ProjectsFragment extends ListFragment { @Override public void

Long click on ListFragment

寵の児 提交于 2019-12-03 01:03:33
I'm working with a ListFragment and doing a onListItemClick. Everything works fine, but now I want to use a long Item Click (e.g setOnItemLongClickListener(new OnItemLongClickListener() for an Activity). How can I use this in my fragment? Thanks! Yes, the solution posted by tsync works for me. I too had ran into same problem and considered that this is not possible. I tried the above suggestion as follows: public class ProjectsFragment extends ListFragment { @Override public void onActivityCreated(Bundle savedState) { super.onActivityCreated(savedState); getListView()

Set long click listener for listview

随声附和 提交于 2019-12-01 15:35:54
I have below codes: public class MainActivity extends ListActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } protected void onListItemClick(ListView l, View v, final int position, long id) { super.onListItemClick(l, v, position, id); }} I need to change this to onListItemLongClick() but how? Is it possible? Daniel Nugent Your question is very similar to this one , but it looks like it's not an exact duplicate. What you've noticed is that the ListActivity class does not have a method override specifically

Set long click listener for listview

房东的猫 提交于 2019-12-01 14:31:01
问题 I have below codes: public class MainActivity extends ListActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } protected void onListItemClick(ListView l, View v, final int position, long id) { super.onListItemClick(l, v, position, id); }} I need to change this to onListItemLongClick() but how? Is it possible? 回答1: Your question is very similar to this one, but it looks like it's not an exact duplicate.

Android OnLongClickListener strange / unreliable behaviour

六月ゝ 毕业季﹏ 提交于 2019-12-01 08:02:16
问题 I'm currently fighting against the OnLongClickListener on Android Api Lvl 8. Take this code: this.webView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { System.out.println("long click"); return true; } }); It works perfectly. I can press anywhere on the WebView and the event triggers every time. Now take a look at this one: this.webView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { final

Android ActionBar options long click event

主宰稳场 提交于 2019-11-28 01:26:09
问题 Android Can anyone know about Actionbar item options long click , I want to show text on LongClick on actionbar menu option like a hint on long press of actionBar long press 回答1: Do you want to capture long press on menu item on action bar? As for me, after finding 2,3 hour, I found this solution. This is perfectly work for me. @Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); new Handler().post(new Runnable() { @Override public void