简体   繁体   中英

LaunchMode singleTask from android activity

I added to a activity android:launchMode="singleTask" to escape a memory consumption problem (Explanation: that activity contained bitmaps & lets say i had that activity in the backstack, when i received intent with my broadcast & opened that activity -> i had 2 of the same activity consuming memory due to their bitmaps)

<activity android:name=".activity.XActivity" android:launchMode="singleTask">

but now i have other problem, that activity is the main activity, so each click on app icon restarts app (in the sense that without this attribute, click on app icon will bring to front the current activity of the app)

How can i escape this? I've also tried some combinations of flags when sending intent.. but not much success..

这可能对您有帮助。

          notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_SINGLE_TOP);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM