Android---------------Activity的學習
一、Activity的啟動方式
1.顯示啟動
Intent intent=new Intent(MainActivity.this,SettingActivity.class);
//還可以這樣寫
Intent intent=new Intent();
intent.setClass(MainActivity.this,SettingActivity.class);
intent.putExtra(EXTRA,contentEditText.getText().toString());
startActivity(intent);
Manifest檔案描述為:
<activity android:name=".SettingActivity"
android:label="@string/app_name">
</activity>
2.隱示啟動
<activity android:name=".SecondActivity" >
<intent-filter>
<action android:name = "android.intent.action.SEND" />
</intent-filter>
</activity>
Intent Intent intent = new Intent();
//設定Intent的Action屬性 intent.setAction("android.intent.action.SEND
// 啟動Activity startActivity(intent);