first of all, i'm a noob at java programing for android. Now, I have a button in the main layout that suppose to call an activity, now what do I write in the onClick method of the button? and I can't use onCreate in the activity that is being called, so what do I use in there? thanks
Put this code in the onClick
method:
Intent intent = new Intent(getApplicationContext(), Activity.class);
startActivity(intent);
The system will start the activity Activity
as soon as possible, which will lead to it's onCreate
method being called.