• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps need help!!!!

hi..i new to this development android things..

i develop some application and using a button..but i do not know how to add a command inside the button to make it function..

can anybody help me??
 
You have to set onclick listener on the button.
The easiest way to do that is to add an attribute in xml layout file to your button:
HTML:
android:onClick="here_the_name_of_listener"
And then in activity create listener with that name
HTML:
public void here_the_name_of_listener(View view){
//here what will happen in case of click
Toast.makeText(getApplicationContext(), "Button clicked", Toast.LENGTH_SHORT).show();
}
 
hey friends!! thanks..

i have another problem can u help me??

i create an app..i want to write a command that to set some temperature at the button such as 24 degree..can u help me??
 
I think you need to read some tutorial first, cause that the very basic stuff.
You can set text on the button like this:
HTML:
button.setText("Your text");
 
Back
Top Bottom