1
How can I click a button and make the other button visible??
Button vibrar;
cor = (Button) findViewById(R.id.cores);
public void clica (View View){
cor.setVisibility(View.VISIBLE);
}
1
How can I click a button and make the other button visible??
Button vibrar;
cor = (Button) findViewById(R.id.cores);
public void clica (View View){
cor.setVisibility(View.VISIBLE);
}
1
What you lack is having one Listener on the button vibrar
and in this Listener change the visibility of the button cor
. For example:
Button vibrar = (Button) findViewById(R.id.vibrar);
Button cor = (Button) findViewById(R.id.cores);
vibrar.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
cor.setVisibity(View.VISIBLE);
}
});
Thank you so much for your help
-1
I think that solves.
Button bt1 = findViewById(R.id.bt1);
Button bt2 = findViewById(R.id.bt2);
bt1.setOnclickListerner(new ... {
bt2.setVisibility("gone");
});
It’s only the base, you have to fix it... You don’t want it all right.
Browser other questions tagged java android button visibility
You are not signed in. Login or sign up in order to post.
In what language?
C#
Java
???– JcSaint
The language is Java.
– sergiopm
You have to create a
OnClickListener
to receive the button click, through the methodSetOnClickListener
.– Marco Giovanni
You inserted the
onclick
in the button vibrate in the xml file, correct? But vc is setting the id, as you did in the color button ?vibrar = (Button) findViewById(R.id.vibrar);
– Rodrigo Paixão