Returns an Activity jump without data or returned activity.
Public class MainActivity extends Activity {
Button bt;
Context context;
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
Context = this; // stores the instance of the current Activity
SetContentView (R. layout. activity_main );
Bt = (Button) findViewById (R. id. bt );
Bt. setOnClickListener (new OnClickListener (){
@ Override
Public void onClick (View arg0 ){
SetContentView (R. layout. second );
Intent intent = new Intent (context, Second. class); // sets this Activity to jump to another Activity
StartActivity (intent); // start the target Activity
}
});
}
}
Public class Second extends Activity {
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. second );
Intent intent = getIntent (); // receives the Activity from the start Activity
}