-1

How can I hypertext a textView to an activity not to a url ? I have a textView "Sign up" which I want to take the user to an activity .

Please help me

Angel
  • 1
  • 5

1 Answers1

0

Try this code

Spanned signUpString=Html.fromHtml("<u><font color=\"#ffbb00\">signUp</font></u>");

    SpannableString ss = new SpannableString(signUpString);

    ClickableSpan clickableSpan = new ClickableSpan() 
    {
        @Override
        public void onClick(View textView) 
        {
            startActivity(new Intent(FirstActivity.this, Second.class));
        }
    };

    ss.setSpan(clickableSpan, 0 , 6, Spannable.SPAN_INTERMEDIATE);

    TextView signUpTextView=(TextView)findViewById(R.id.yourTVid);
    signUpTextView.setText(ss);
    signUpTextView.setMovementMethod(LinkMovementMethod.getInstance());

I hope this helps you...

A.R.
  • 2,631
  • 1
  • 19
  • 22