onclick button in java android
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
onclick button in java android
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
onclick android
//declare and define the button
Button button = (Button) findViewById(R.id.button1);
//method 1: set the onclick eventlistener with java only
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
/////
//method 2:use also layout code (xml)
//xml:
//add the following :
android:onClick="functionName"
//to the view you want to add the eventlistener to
//java: add to the main class
public void functionName(View v) {
}
onclick method android
public void clickFunction (View view){}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us