How to set onclick function to dynamic textview in android?
<p>I set the <code>onClick()</code> function, but when I click the text it works two times that mean I have two dynamic text view. How to resolve it?</p>

<p>My code:</p>

<pre><code>TextView tView[] = new TextView [Array.length];
for(int i =1; i&lt;Array.length; i++)
{
    tview[i] = new TextView(this);
    tview[i].setId(i);
    tview[i].setText(Array[i]);
    tview[i].setOnTouchListener(new OnTouchListener()
    {
        Public boolean onTouch(View v ,MotionEvent event)
        {
            Toast.makeText(getApplicationcontext,"MapVal",Toast.LengthShort).show();
        }
    });
}
</code></pre>
