Android - Selectable TextView inside a listview
<p>I got a problem when trying to copy the content of TextView inside a listview on my Sony Xperia.</p>

<p>This is my listview:</p>

<pre><code>&lt;ListView
    android:id="@+id/list_1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:cacheColorHint="@android:color/transparent"
    android:divider="#00000000"
    android:listSelector="@android:color/transparent"/&gt;
</code></pre>

<p>And this is my list_item:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="wrap_content"&gt;
    &lt;TextView
    android:layout_width="match_parent"
    android:id="@+id/editText1" android:layout_height="wrap_content" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>And my code:</p>

<pre><code> @Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     ListView list = (ListView) findViewById(R.id.list_1);
     ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;();
     data.add("AAAAAAAAA");
     data.add("BBBBBBBBBB");
     data.add("CCCCCCCC");
     data.add("DDDDDDDDD");
     list.setAdapter(new MyAdapter(data));
}
</code></pre>

<p>This is my adapter:</p>

<pre><code>private class MyAdapter extends BaseAdapter{
    private ArrayList&lt;String&gt; mData;
    public MyAdapter (ArrayList&lt;String&gt; data){
        super();
        mData = data;
    }
    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null) {
            convertView = getLayoutInflater().inflate(
                    R.layout.list_item, parent, false);
        }
        String str = mData.get(position);
        TextView tv = (TextView) convertView.findViewById(R.id.editText1);
        tv.setText(str);
        tv.setTextIsSelectable(true);
        return convertView;
    }
}
</code></pre>

<p>I found on some threads that setTextIsSelectable(true) will allow copying text on TextView, but look like it's not work if TextView inside a listview.</p>

<p>Could you guys help me a solution?</p>
