代码
<activity
android:name=".IconOne"
android:icon="@drawable/ic_launcher"
android:label="icon1"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:screenOrientation="nosensor" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity-alias
android:name="combine"
android:label="icon2"
android:targetActivity=".IconOne" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity-alias>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_icon_one);
Log.d("debug", "onCreate" + getIntent().getComponent().getClassName());
}
@Override
protected void onNewIntent(Intent intent) {
// TODO Auto-generated method stub
super.onNewIntent(intent);
setIntent(intent);
Log.d("debug", "onNewIntent" + intent.getComponent().getClassName());
}
这里使用activity-alias实现多个launch一起进入了IconOne.
需要注意的是:
1. IconOne中需要使用
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
否则, 下一次按Home退出后,按另一个icon进入就不会调用onNewIntent();
2. onNewIntent中注意setIntent否则getIntent()会是之前的intent.
分享到:
相关推荐
+ <activity-alias android:name=".EthernetSettings" + android:label="@string/ethernet_settings" + android:clearTaskOnLaunch="true" + android:targetActivity="Settings$EthernetSettingsActivity" + android...
Android学习笔记-Activity篇 Contents Android学习笔记-Activity篇 1 一、activity创建: 1 二、在manifest.xml中声明activity: 1 三、启动activity 1 3.1 启动不带返回结果的Activity 1 3.2 启动带有返回结果的...
GlobalScope.launch { delay(1000) println("Hello from Kotlin Coroutines!") } Modules common — common coroutines across all platforms: launch and async coroutine builders; Job and Defer
Android 3.1 introduces Launch controls on stopped applications. However, there are no such features on android 2.3, some 4.X devices didn't implement it well. Furthermore, there are some way for apps ...
Android的Activity的Launch模式之Standard案例,实际案例源码
Android的Activity的Launch模式之SingleTask案例,实际案例源码
Android的Activity的Launch模式之SingleInstance案例,实际案例源码
PreLoader: Make your activity launch faster changelog 中文文档 Pre-load data before Activity opens, and display data on UI after UI initialization. Speedup Activity launch You can start a PreLoader...
2.要点:跳转小程序:wx-open-launch-weapp 用于页面中提供一个可跳转指定小程序的按钮。使用此标签后,用户需在网页内点击标签按钮方可跳转小程序; 3、确保你的网页中引入了微信提供的JavaScript SDK,一定要是...
It supports swapping new implementations of classes without restarting a running Android application, and updated Android resources (icons, layout, etc) while only restarting the Android Activity. ...
PullLaunchRocket ...We use Launch-Rocket as our default style. And also, we provided a custom refresh style - sunrise Attention : version 1.0.2 is just a pre-release. Usage You can have a look
Android的Activity的Launch模式之SingleTop案例,实际案例源码
To launch from an Activity : compile 'com.natewickstrom.rxactivityresult:rxactivityresult:0.1.0-rc3' To launch from a Fragment : compile '...
压缩包涵盖 sbt-launch-0.11.0,sbt-launch-0.11.2,sbt-launch-0.11.3,sbt-launch-0.13.9版本
Firefox Focus for Android Browse like no one’s watching. The new Firefox Focus automatically blocks a wide range of online trackers — from the moment you launch it to the second you leave it. ...
Android PictureInPicture ...As of Android O, activities can launch in Picture-in-Picture (PiP) mode. PiP is a special type of multi-window mode mostly used for video playback. The app is paused when it
BackgroundViewPager实现桌面launch移动.zip
AndroidRTC WebRTC Live Streaming An Android client for ProjectRTC. It is designed to demonstrate WebRTC video calls between androids and/or desktop browsers, but WebRtcClient could be used in other ...
A small helper application, intended to open Android Market URLs from a browser (which normally they refuse to do). Registers to handle urls in the 'marketlauncher:' scheme from the browser. Checks ...
Android开发常见问题.doc ... com.yuankai.android.study.HelloAndroid activity launch [2009-04-29 15:06:25 - HelloWorld] Failed to find an AVD compatible with target 'Android 1.5'. Launch aborted.