Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich view am I passing above?
    text
    copied!<p>I had a TableLayout with TextViews in each cell:</p> <pre><code>&lt;LinearLayout 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" android:background="@android:color/darker_gray" android:orientation="vertical" tools:context=".SopitaActivity" &gt; &lt;TableLayout android:id="@+id/tableLayout" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_margin="50dip" android:layout_weight="0.7" &gt; &lt;TableRow&gt; &lt;TextView android:text="00" android:padding="10dip"/&gt; &lt;TextView android:text="01" android:padding="10dip" /&gt; &lt;TextView android:text="02" android:padding="10dip" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;TextView android:text="10" android:padding="10dip" /&gt; &lt;TextView android:text="11" android:padding="10dip" /&gt; &lt;TextView android:text="12" android:padding="10dip" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;TextView android:text="20" android:padding="10dip" /&gt; &lt;TextView android:text="22" android:padding="10dip" /&gt; &lt;TextView android:text="23" android:padding="10dip" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>And I want to detect which one I´m passing with a long press (or another one).<br> I´ve tried to assign <code>OnTouchListener</code> and <code>OnLongClickListener</code> and a tag to each textview, and then detect when they are touched, but not when changed of view.</p> <pre><code>@Override public boolean onTouch(View v, MotionEvent event) { Log.v("CCC", "i: " + v.getTag()); } @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub Log.v("DDD", "ii: " + v.getTag()); return false; } </code></pre> <p>Thanks a lot to everyone!</p> <p>The issue is that in the LogCat only appears the first Textview clicked.<br> If I do this movement:</p> <p><img src="https://i.stack.imgur.com/BssWE.png" alt="enter image description here"></p> <p>I would like to see in the logcat (for example):</p> <pre><code>ii: 00 ii: 10 ii: 20 </code></pre>
 

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