天天看點

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();      
下一篇: 個人總結