Skip to content

Instantly share code, notes, and snippets.

@msomu
Created November 1, 2014 05:25
Show Gist options
  • Select an option

  • Save msomu/3af4a9ded6ad6be17c01 to your computer and use it in GitHub Desktop.

Select an option

Save msomu/3af4a9ded6ad6be17c01 to your computer and use it in GitHub Desktop.
Button click using ClickListener
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/abc_action_bar_home_description"
/>
public class MyActivity extends ActionBarActivity implements View.OnClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Log.d("SOMU","On Create called");
setContentView(R.layout.activity_my);
one = (Button) findViewById(R.id.button1);
one.setOnClickListener(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment