-2

I would like to access a clickable textview in my Java Code, to make it act like a hyperlink or <a> in html.

<TextView android:id="@+id/register" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:text="@string/signUp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toEndOf="@+id/textView" app:layout_constraintTop_toBottomOf="@+id/loginBtn" app:layout_constraintVertical_bias="0.424" /> 

The above is my XML of the textview.

0

2 Answers 2

-1

You can save your TextView in a variable, I've also changed it's text.

TextView register = (TextView)findViewById(R.id.register); register.setText("newText"); 
Sign up to request clarification or add additional context in comments.

Comments

-1

you can use setOnClickListener

TextView textView=(TextView)findViewById(R.id.registrar); textView.setOnclickListener(new View.OnclickListener(){ @Override void onclick(View v){ // body } }); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.