Change text from Textview

Asked

Viewed 37 times

0

I have a Textview to which I use a String as the text, I wanted to know if it is possible through a click to change this String(text) to a new text that is typed.

public class Texto extends Activity {
TextView Txtmessage;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.texto );

Txtmessage = (TextView)  findViewById( R.id.EdtMensagemCalendar );
Txtmessage.setText( Txt );
Txtmessage.setOnClickListener( new View.OnClickListener() {
    @Override
    public void onClick(View v) {

    }
} );
}

I wanted to know if inside Onclick I can create an option for the user to type the message you want and so change the String(Txt).

  • 2

    Yes. You create a dialog that will be created and displayed by clicking on Textmessage. In this dialog there is a button and a textEdit. The user informs the text and clicks on the button and at that time you change the text.

  • Thank you. What would that code look like?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.