i have app 2 launcher icons , 2 different activities. manifest file below:
.... <activity android:name=".myactivity" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:taskaffinity="my.package.com.myactivity"> <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> <activity android:name=".mysettings" android:label="@string/settings" android:icon="@mipmap/ic_launcher" android:taskaffinity="my.package.com.mysettings"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> .... i want myactivity default screen opened after installing, used .category.default.
action.main , category.launcher show 2 separate launcher icons (1 myactivity, 1 mysettings).
problem: when open myactivity, mysettings screen gets opened. want each launcher icon open corresponding activity only. have used taskaffinity each activity solve problem did not work. think make taskaffinity work, activity must started flag intent.flag_activity_new_task can not in case (both launch activities).
i have tried use android:launchmode="singletask" did not work either.
how make each launcher icon open activity ?
update: sorry, realized myactivity not open mysettings, seemed though. myactivity did not have ui, showed blank screen similar mysettings. taskaffinity works correct. have added android:theme="@android:style/theme.nodisplay" myactivity hide ui.
i solved way:
<activity android:name="andynaz.android.hyperfcalc.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="andynaz.android.hyperfcalc.mainactivity2" android:label="@string/app_name" android:icon="@mipmap/ic_launcher2"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> i did not use taskaffinity, indicated specified name of activity classes (other using 2 different images).
Comments
Post a Comment