Friday, October 31, 2014

Button click method 2

This is button click method 2 using onclicklistener
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/abc_action_bar_home_description"
/>
view raw activity_my.xml hosted with ❤ by GitHub
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);
}
}
view raw MyActivity.java hosted with ❤ by GitHub

No comments:

Post a Comment