Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid multitouch, action pointer down not working properly
    text
    copied!<p>i have tried to detect two touches on my two imagebuttons which is single Relative layout . The problem is its showing action_down values on both buttons but no action pointer down value.</p> <p>My code is as follows:</p> <pre><code>private int getIndex(MotionEvent event) { int idx = (event.getAction() &amp; MotionEvent.ACTION_POINTER_INDEX_MASK) &gt;&gt; MotionEvent.ACTION_POINTER_INDEX_SHIFT; return idx; } @Override public boolean onTouch(View paramView, MotionEvent paramMotionEvent) { // TODO Auto-generated method stub // Boolean state=false; // int pointerCount = paramMotionEvent.getPointerCount(); boolean val = false; int pointerIndex = paramMotionEvent.getAction() &amp; MotionEvent.ACTION_MASK; switch(pointerIndex) { case MotionEvent.ACTION_DOWN :{ Log.i("fil", "action dowm"); break; } case MotionEvent.ACTION_POINTER_DOWN :{ int id = paramMotionEvent.getPointerId(getIndex(paramMotionEvent)); Log.d("fil", "Other point down ["+id+"]"); Log.i("fil", "action pointer down"); break; } case MotionEvent.ACTION_POINTER_UP :{ int id = paramMotionEvent.getPointerId(getIndex(paramMotionEvent)); Log.d("fil", "Other point down ["+id+"]"); Log.i("fil", "action pointer up"); break; } case MotionEvent.ACTION_UP :{ Log.i("fil", "action up"); break; } } 'my xml' &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:gravity="center"&gt; &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" &gt; &lt;/RelativeLayout&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ic_launcher" /&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="100dp" android:background="@drawable/ic_launcher" /&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload