I am trying to use two buttons in one layout:
- a button to notes, which is working below
- a button to calculator (button10)
I get this error on super.oncreate:
"The method onCreate(Bundle) is undefined for the type Object"
main.java:
public class IzzynActivity extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button wg = (Button) findViewById(R.id.button1);
wg.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(IzzynActivity.this, notes.class);
IzzynActivity.this.startActivity(myIntent);
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button wg = (Button) findViewById(R.id.button10);
wg.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(IzzynActivity.this, calculator.class);
setResult(RESULT_OK, intent);
finish();
}
});
}
}
}
}
I don’t know exactly what you did in that class but if you want two buttons in your layout then put them in your layout and search for them in the activity’s
onCreatemethod:R.layout.main
and then in your activity: