I have a listview with item. Click on an item it goes to another activity. My problem is on clicking on multiple items (say 3 0r4 ) all clicked are loaded. But i dont need it. Only want to load 1 item at a time. Tested on HTC one,samsung galaxy s plus. Please help.
Asked
Active
Viewed 1,153 times
2
-
2Put some code that you have try. – Shreyash Mahajan Feb 04 '13 at 05:34
-
can u able to show your code here – Sree Feb 04 '13 at 05:34
-
Can you please show some code or anything that can make anyone to understand your issue ? – GrIsHu Feb 04 '13 at 05:48
-
Whether you use adapter? so that based on position ie which item you choose,you can use that.and others you can restrict by not using the position of item. – Shadow Feb 04 '13 at 05:50
-
Disable multi finger touch in your app http://stackoverflow.com/questions/12777435/disable-multi-finger-touch-in-my-app – shijin Feb 05 '13 at 09:32
-
http://stackoverflow.com/questions/12777435/disable-multi-finger-touch-in-my-app – shijin Feb 05 '13 at 09:33
-
Did you want onClick for any specific item? – Vishwesh Jainkuniya May 12 '16 at 01:57
3 Answers
3
You can detect multitouch and neglect it.
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if(event.getPointerCount() > 1) {
System.out.println("Multitouch detected!");
return true;
}
else
return super.onTouchEvent(event);
}

Sourav301
- 1,259
- 1
- 14
- 24
-
-
@NehemiahNarzary you can implement the onTouchEvent in your activity. Just paste this code in your activity class and it should work. – Sourav301 Jun 02 '21 at 15:30
0
use the follow method can solve that:
public class FastClickUtil {
private static long lastClickTime;
public synchronized static boolean isFastClick() {
long time = System.currentTimeMillis();
if ( time - lastClickTime < 500) {
return true;
}
lastClickTime = time;
return false;
}
}
put that method in your onItemCLickListner or in your adapter‘s getview like me
holder.title.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 解决短时间内同时点击多个item
if (FastClickUtil.isFastClick()) {
return;
} else {
Message msg = Message.obtain();
msg.what = MSG_WHAT_ONITEM_CLICK;
// Bundle data = new Bundle() ;
// msg.setData(data) ;
msg.obj = menuItem.getTitleResId();
getHandler().sendMessage(msg);
}
}
});

CodingForAndroid
- 1
- 1
0
To stop this, Use this in your list view.
android:splitMotionEvents="false"

Nehemiah Narzary
- 336
- 4
- 11