public class check extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
void myonclick(View view)
{
Intent mIntent = new Intent(this,check2.class);
startActivity(mIntent);
}
}
class check2 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
Toast.makeText(
this,
"Welcome to second page", Toast.LENGTH_LONG).show();
finish();
}
}
Hi. This is my code when I run this. When I click a button it will show error in emulator: The Application Check has stopped unexpectedly.
Have you declared both the activities in manifest file ?
The main activity should have the following intent-filter tag
The second activity to be declared as
Also calling finish() in the second activity would immediately return the control to the first activity.