You just need something like this:
Button buttonOne = (Button) findViewById(R.id.button1);
buttonOne.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
//Do stuff here
}
});
More Related Contents:
- Update infomation every time [closed]
- App crashes when changes are made in Realm database
- Sign android application
- Android Push Notifications: Icon not displaying in notification, white square shown instead
- Resume application and stack from notification
- Toggle airplane mode in Android
- Android Layout Weight
- Latest update on enabling and disabling mobile data programmatically [duplicate]
- Lost my keystore for uploaded app on android market [duplicate]
- Facebook – “Cannot query users by their username” solution
- SHA1 Key for DEBUG & RELEASE ANDROID STUDIO MAC , How to generate SHA1 Release Keys in Mac?
- NullPointerException when trying to access views in a Kotlin fragment
- Android Material: Status bar color won’t change
- Get certificate fingerprint from android app
- Simple way to do dynamic but square layout
- GATT callback fails to register
- Get thumbnail Uri/path of the image stored in sd card + android
- How do I show the number keyboard on an EditText in android?
- ANR keyDispatchingTimedOut error
- Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’ in android studio
- OutOfMemory exception when loading bitmap from external storage
- Android ACTION_MOVE Threshold
- How to write curved text? [closed]
- Difference between addValueEventListener() and addListenerForSingleValueEvent() of firebase
- What happens to older clients when you migrate an app server from GCM to FCM?
- Android: Disable soft keyboard at all EditTexts
- Set starting height of CollapsingToolbarLayout
- How to replace a string for a buildvariant with gradle in android studio?
- ListView without ListActivity
- android live wallpaper rescaling