long-click

clicklistener and longclicklistener on the same button?

故事扮演 提交于 2019-12-19 10:40:14
问题 i am creating a call/dial button, when i click on that call/dial button, a call will be made based on the input that is displayed in the edittext. I managed to do that part. can you guys advise me whether i can do a longer click on that same call/dial button, so that a toast can come out to ask user to choose something else?? I did some research on "setOnLongClickListener" but i am not sure if i can combine it in the same call/dial button? I have attached on the working dial function which i

Stop OnLongClickListener from firing while dragging

孤人 提交于 2019-12-18 04:46:12
问题 I have a custom View with bitmaps on it that the user can drag about. I want to make it so when they long click one of them I can pop up a context menu with options such as reset position etc. In the custom View I add my OnLongClickListener: this.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { // show context menu.. return true; } }); And override onTouchEvent to look something like this: public boolean onTouchEvent(MotionEvent event) {

Google now won't let my app detect headset button long click

不羁的心 提交于 2019-12-14 02:33:49
问题 I want my app to do some specific actions when user long clicks (press and hold) headset button. I use a BroadcastReceiver for MEDIA_BUTTON and it works fine in phones who doesn't run Google now app for sound actions for long press. But in the phones that automatically run Google now my app is just being ignored. How can I disable Google now and detect headset button long click. here is onReceive method in my BroadcastReceiver class. public void onReceive(Context context, Intent intent) {

Android: using AlertDialog when an item from a listview is long pressed

与世无争的帅哥 提交于 2019-12-13 05:18:44
问题 I have a list of items, created by a listview. I would like to long press one of the items on the list and an alert dialog to open up and depending on yes or no key on that dialog box I wan to set a global variable. The code that I am using is inside "MyActivity.java" and looks like this: ListView lv = getListView(); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> av, View v, int pos, final long id) { final

Change the long click functionality of the home button

戏子无情 提交于 2019-12-12 20:19:39
问题 I am looking for Android 'trick' to change the functionality of the long click on the home button. Currently, long click on the home button open the task manager. Instead, I want the long click to act as short click which means take us to the home page of the default launcher. Ideally, this trick will work for all Android versions, but if it will work for 2.3.x only or 4.x.x only then this is good enough. (I managed to disable the long click with Android 2.3.x but now i am looking to use the

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

陌路散爱 提交于 2019-12-12 08:48:11
问题 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

Trigger multiple selection on long click

淺唱寂寞╮ 提交于 2019-12-11 08:05:48
问题 I'm building a File manager on android platform.I want my users to be able to select multiple files on long click on a file.How to do it?(In list view) Thanks in advance. 回答1: Assuming you're using a ListView , I believe you're looking for android:choiceMode="multipleChoiceModal" or setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL) 来源: https://stackoverflow.com/questions/29474697/trigger-multiple-selection-on-long-click

ListView Long Click Animation

∥☆過路亽.° 提交于 2019-12-07 20:48:33
问题 I would like to capture long click events in a ListView, which was easily done using a OnItemLongClickListener. However, that lacks the fading animation of the selector transitioning to a long press that is seen when the long click is handled by onCreateContextMenu. How can I get that animation using OnItemLongClickListener ? 回答1: I was having the same problem and resolved it by removing the following property in the LinearLayout for my rows: android:clickable="true" Removing that property or

Android : How to listen to longclick events in any text area in other applications?

╄→гoц情女王★ 提交于 2019-12-07 09:06:02
问题 I'm trying to develop an Android application that provides an extra option when pasting data anywhere. I know how to capture data from the clipboard. I just need to know how to listen to longclick events in any text area in other applications such as browsers,facebook,twitter...etc so that my application would be triggered giving the user the option to paste the data on the clipboard after processing it, as an alternative to pasting it in the normal way. 回答1: We've come a long way since you

ListView Long Click Animation

你离开我真会死。 提交于 2019-12-06 07:11:00
I would like to capture long click events in a ListView, which was easily done using a OnItemLongClickListener. However, that lacks the fading animation of the selector transitioning to a long press that is seen when the long click is handled by onCreateContextMenu. How can I get that animation using OnItemLongClickListener ? I was having the same problem and resolved it by removing the following property in the LinearLayout for my rows: android:clickable="true" Removing that property or setting the value to false both fixed the problem. Make sure the enclosing list item's view specifies: