Send message from button

Asked

Viewed 44 times

-4

I wanted to ask how can I send message from a button or message this written on that button

  • 1

    From what it seems you are wanting to learn how to program for Android in a question, this does not cost, I recommend you study Java, if you do not know, and then enter Android with some videos or articles

1 answer

1

Example:

Button botao = (Button) findViewById(R.id.meuBotao);

String mensagemEscritaNoBotao = botao.getText();

botao.setOnClickListener(new View.OnClickListener() {
     public void onClick(View v) {
           // Ação para ser executada quando o botão é clicado
     }
});
  • Thanks for the tip. Could you tell me what the XML part looks like please

  • R.id.meuBotao is the id you find in XML

  • With this code you sent me I can create an action to record in Firebade or how can I do it

Browser other questions tagged

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