<span id="Label3"></p><p><p><span style="font-size:14px">When the app was installed, some apps generated two icons on the desktop, some of which were the same activity entry, and some of the other Activity's portals, how did that happen? Look at the Android native Deskclock program and see the implementation of this feature. using Activity-alias:</span></p></p><p><p><span style="font-size:14px">1. Syntax format</span></p></p><p><p></p></p><pre name="code" class="java"><pre name="code" class="java"><activity-alias android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon= "drawable resource" android:label= "string resource" android:name= "string" android:permission= "string" android:targetactivity= "string" > : .</activity-alias></pre></pre><br><span style="font-size:14px"><span style="font-size:14px">application in 2.DeskClock</span></span><p><p></p></p><p><p><span style="font-size:14px">As you can see from the configuration below, This is the two entry for the same activity (deskclock), and the names of both portals are the same, what is the point of doing this? You can see that a category named Android.intent.category.DESK_DOCK is marked in activity-alias, which triggers the alias entry when the Android device is plugged into the desktop dock.</span></p></p><p><p></p></p><pre name="code" class="java"><activity android:name= "deskclock" android:label= "@string/app_label" android:theme= "@style/deskclock" android:icon= "@mipmap/ic_launcher_alarmclock" android:launchmode= "singletask" > <intent-f ilter> <action android:name= "android.intent.action.MAIN"/> <category android:name= "android.in Tent.category.DEFAULT "/> <category android:name=" Android.intent.category.LAUNCHER "/> </intent-fi Lter></activity><activity-alias android:name= "dockclock" android:targetactivity= "DeskClock" an droid:label= "@string/app_label" android:theme= "@style/deskclock" android:icon= "@MIPMAP/IC_LAUNCHER_ALARMCL Ock "android:launchmode=" singletask "android:enabled=" @bool/config_dockappenabled "> <in tent-filter> <action android:name= "android.intent.action.MAIN"/> <category android:name= "android Oid.intent.category.DEFAULT "/> <category android:name=" Android.intent.category.DESK_DOCK "/> </intent-filter></acti Vity-alias></pre><p><p><span style="font-size:14px">Activity-alias determines the activity of the portal connection by specifying the targetactivity, changes a different label (clockalias) and icon (chrysanthemum) to the program, and replaces the category of the dock base, As shown in the lower code Configuration.</span></p></p><p><p></p></p><pre name="code" class="java"><pre name="code" class="java"><activity-alias android:name= "dockclock" android:targetactivity= "deskclock" android:label= "@string/ App_second_label " android:theme=" @style/deskclock " android:icon=" @mipmap/entrance " android: Launchmode= "singletask" > <intent-filter> <action android:name= " Android.intent.action.MAIN "/> <category android:name=" Android.intent.category.DEFAULT "/> < Category Android:name= "android.intent.category.LAUNCHER"/> </intent-filter></activity-alias ></pre></pre><br><p><p><span style="font-size:14px">In this way, the configuration can be implemented in the Android device on the dual portal icon, click on the two icons can be entered into the Deskclock program, the specific effect as shown</span></p></p><p><p><span style="font-size:14px"><br></span></p></p><p><p></p></p><p><p><span style="font-size:14px"><br></span></p></p><p><p><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px">reprint Please specify source:</span>http://blog.csdn.net/l2show/article/details/46828391<br></p></p><p><p><br></p></p><p><p></p></p><p><p>Android activity-alias multi-entry Configuration</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service