天天看点

Android界面跳转几种情况

    Android界面简单跳转,

Intent intent =new Intent(MainActivity.this,SecondActivity.class);
           startActivity(intent);
      

  带参数跳转

Intent intent=new Intent();
	intent.setClass(MainActivity.this, SecondActivity.class);
			Bundle bundleSimple = new Bundle();  
			bundleSimple.putLong("180", Height);  
			bundleSimple.putLong("22", age);  
			bundleSimple.putString("sdad", name);
	intent.putExtras(bundleSimple); 
	setting.this.startActivity(intent);
      

  跳转并销毁前面页

Intent intent=new Intent();
intent.setClass(SecondActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();      
下一篇: 个人总结