Created
June 13, 2012 11:16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.android.sample.events; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
public class BaseActivity extends Activity | |
{ | |
// declare variable to represent our components... | |
Button quitButton; | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
// inside this method we reference our button... | |
setupViews(); | |
} | |
private void setupViews() | |
{ | |
// quitButton is linked to our button created in the layout... | |
// using the id... | |
quitButton=(Button)findViewById(R.id.quit_button_id); | |
} | |
// this method is called when the quit button is pressed... | |
// note that it has an argument of type "View" which is mandatory... | |
public void myOnClickMethod(View v) | |
{ | |
finish(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment