[Solved] How to convert textview as link in android?


You have to setOnTouchListener to the TextView. Here I give you an example:

    public class MainActivity extends Activity implements View.OnTouchListener { 
      private TextView tv1; 

      @Override 
      public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_main); 

        tv1 = (TextView) findViewById(R.id.tv1); 

        tv1.setOnTouchListener(this); 

      } 

      @Override 
      public boolean onTouch(View v, MotionEvent event) { 

       // HERE YOU HAVE TO CHECK WHICH ID IS SELECTED, IF YOU HAVE MORE THAN ONE,
       //   AND WHICH EVENT HAS THE USER DONE.

      // IN YOUR CASE.. OPEN WEBSITE LIKE THIS:


Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);

        return true; 
      } 
    }

2

solved How to convert textview as link in android?