Friday, October 31, 2014

Button Click on Android

This is the first method of button Click
public void doSomething(View v){
if(v.getId()==R.id.button1){
Log.d("SOMU","Button was clicked");
}
}
view raw MyActivity.java hosted with ❤ by GitHub
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/abc_action_bar_home_description"
android:onClick="doSomething"/>
view raw myActivity.xml hosted with ❤ by GitHub

No comments:

Post a Comment