<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.intentflags">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//另外两个activity
<activity android:name=".Main2Activity"> </activity>
<activity android:name=".Main3Activity"></activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.administrator.intentflags.MainActivity">
<Button
android:text="第一个页面"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="click1" />
<Button
android:text="第二个页面"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="click2" />
<Button
android:text="第三个页面"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="click3" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
//其余两个仅文字不一样
android:text="第一个页面"
android:textSize="50sp"/>
</LinearLayout>
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
/**
* Created by panchengjia on 2016/12/14.
*/
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//其他两个界面此处引用各自对应的layout文件
setContentView(R.layout.activity_main);
}
public void click1(View view){
Intent intent = new Intent(this,MainActivity.class);
startActivity(intent);
//记录Taskid用于实验说明
Log.i("Tag","页面一taskId:"+getTaskId());
}
public void click2(View view){
Intent intent = new Intent(this,Main2Activity.class);
startActivity(intent);
Log.i("Tag","页面二taskId:"+getTaskId());
}
public void click3(View view){
Intent intent = new Intent(this,Main3Activity.class);
startActivity(intent);
Log.i("Tag","页面三taskId:"+getTaskId());
}
}
<activity android:name=".Main2Activity"
android:launchMode="singleTop"> </activity>
<activity android:name=".Main2Activity"
android:launchMode="singleTask"> </activity>
<activity android:name=".Main2Activity"
android:launchMode="singleInstance"> </activity>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有