How can i know what TextView was clickbale?

Posted by sgiro on Stack Overflow See other posts from Stack Overflow or by sgiro
Published on 2010-04-07T13:50:35Z Indexed on 2010/04/08 9:23 UTC
Read the original article Hit count: 275

Filed under:
|
|

Hello, i have one doubt. I have an iteration of TextViews, and what i want is when i click in one TextView , i want stop the iteration and open a web, who can i know what TextView as been click on? i have this code:

Iterator<TextView> it = text.iterator();
   while(it.hasNext()){

 test = it.next();




 test.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
               //mWebView = (WebView) findViewById(R.id.webview);
               mWebView.setWebViewClient(new WebViewClient() {
                   @Override
                   public boolean shouldOverrideUrlLoading(WebView view, String url) {
                       view.loadUrl(url);
                       return true;
                   }
               });

           mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.loadUrl(url);


              }


              });



      // condition to stop the iteration when i click on TextView 
      }

And what i want is the condition to stop the iteration when i click on the TextView that i want see, i try using some methods that are in the TextView and don't work. Anyone can help me? I have the iteration of TextViews because i want to do this dynamic, and i don't know the TextView who as click, and i want to know what TextView was click to stop the iteration, because if i don't stop this, for example if i have 3 TextView they will open the same web.

Thanks and forgive my English

© Stack Overflow or respective owner

Related posts about textview

Related posts about android