onlongclicklistener

How to detect long click on GoogleMap marker

痞子三分冷 提交于 2020-03-06 08:35:36
问题 In my app I have a MapFragment. I do map = mapFragment.getMap(); and after that add a marker in the event onMapClick(LatLng point){ ... map.addMarker(new MarkerOptions() .position(point) .title(txt)); ... } All this works perfectly. What I need is to know when the user keep long click on the marker I put on the map. I made some handmade calculations in onMapLongClick(LatLng point){ ... if((Math.abs(mrkrPos.latitude-point.latitude)<0.0005)&&(Math.abs(mrkrPos.longitude-point.longitude)<0.0005))

How to detect long click on GoogleMap marker

*爱你&永不变心* 提交于 2020-03-06 08:35:35
问题 In my app I have a MapFragment. I do map = mapFragment.getMap(); and after that add a marker in the event onMapClick(LatLng point){ ... map.addMarker(new MarkerOptions() .position(point) .title(txt)); ... } All this works perfectly. What I need is to know when the user keep long click on the marker I put on the map. I made some handmade calculations in onMapLongClick(LatLng point){ ... if((Math.abs(mrkrPos.latitude-point.latitude)<0.0005)&&(Math.abs(mrkrPos.longitude-point.longitude)<0.0005))

how to trigger proper Longclick event on listview

依然范特西╮ 提交于 2020-01-07 01:18:54
问题 i have to show Android Contextual action mode on long press of list view but when we long press then some multiple event trigger and Contextual menu hide so is there way to handle this problems. i also try return true on onLongClick() but its not working thanks in advance for your help 回答1: After search on stackoverflow i found my answer using this question implement GestureDetector on my listview an here is my code set GestureDetector on listview final GestureDetector gestureDetector = new

Is “dragging with longclick” impossible on Android?

偶尔善良 提交于 2020-01-06 05:28:28
问题 I am working on charts. I can zoom in-out, dragging... Also I need longclick with dragging. if you need to explain, user can longClıck for see charts values, and user can dragging to left, right with longclick to see other values...Can Android sense it? I use achartengine library. I can handle it now:) but I have another problem about.. longPressDetector = new GestureDetector(getContext(), new SimpleOnGestureListener() { @Override public void onLongPress(final MotionEvent e) { int x = (int) e

Ripple effect on TextView long click

微笑、不失礼 提交于 2020-01-06 02:53:05
问题 How do I get a TextView to ripple on long click? It ripples fine onClick but I need the ripple for onLongClick . 回答1: You can use Android Ripple Background final RippleBackground rippleBackground=(RippleBackground)findViewById(R.id.content); ImageView imageView=(ImageView)findViewById(R.id.centerImage); imageView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { rippleBackground.startRippleAnimation(); return false; } }); 回答2: There are

How to access menu button onLongClick in Android?

做~自己de王妃 提交于 2020-01-04 02:04:07
问题 How can I set a listener for long-click performed on hardware Menu button? What is the way of programmatic access to the Menu button? Moreover how can I distinguish long-click from single-click? (As far as I know when long-click is performed the single-click event is propagated as well - I do not want this to happen because I need 2 different actions for these 2 situations. Long-click and single-click separate listeners for the device Menu button) Thank you! 回答1: This shoule be fairly

onLongClickListener does not work on WebView

孤街浪徒 提交于 2020-01-03 17:39:33
问题 I have the following struktur to implement an longclicklistener. It works if I click on a text on the webview which contains a html-link, so I know the structure is not completely wrong. I removed this link now and the listener just doesn't listen to clicks anymore. Does anybody know this problem and have some advices? private View.OnLongClickListener mLongClickHandler = new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { ... return true; } }; ... mywebview

ImageButton onlongpress causes onclick as well

回眸只為那壹抹淺笑 提交于 2019-12-25 04:17:32
问题 i have an application with an imagebutton that has both an onclick and an onlongclick listener. However, when the button is long pressed, both of these listeners are executing. Any suggestions? d1.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { selectMode = true; dockNum = 1; sd1.open(); d1.cancelLongPress(); return false; } }); ...d1.setOnClickListener(this); ...case R.id.d1: if(d1s.equals("empty")) { selectMode = true; dockNum = 1; sd1.open(

Implement Drag & Drop in Gingerbread

时光怂恿深爱的人放手 提交于 2019-12-23 08:58:49
问题 I need to know how I can implement Drag & Drop in Android for the Gingerbread version. As I know Gingerbread doesn't support that by default. What I have coded: a ViewGroup class to hold dynamic added child, each child should after a long click be able to get moved through a finger tap/move. To solve this, i have a OnLongClickListener attached to each View 's child and my ViewGroup have implemented both the methods onTouch() to get the down/up/move events and the method onLongClick() to

Android long click on tab

这一生的挚爱 提交于 2019-12-23 03:14:31
问题 I have a TabHost with some tabs, and after doing a long press on a tab, I want to get the position or the tag of the tab which was long pressed, and not the current tab that is showed. Below there is some code in which I create the long press listener for the TabHost: myTabHost.getTabWidget().getChildAt(i).setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub return false; } }); Any solution? Is correct to apply