Tuesday, March 23, 2010

Instantiate New Activity

public class FirstActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button orderButton = (Button)findViewById(R.id.order);

orderButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View view) {
Intent intent = new Intent(FirstActivity.this, OrderScreen.class);
startActivity(intent);
}

});
}
}






public class OrderScreen extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.order);

Button orderButton = (Button) findViewById(R.id.end);

orderButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View view) {
finish();
}

});
}
}