activity-stack

Android launch an activity from a broadcast receiver

拥有回忆 提交于 2019-11-28 05:57:31
问题 I know it may not be best practice but this is what i want to do. When my broadcast receiver is called - start a new activity which has is not fullscreen and has a transparent background - which opens on top of your current activity / desktop wallpaper. The code I have so far is as follows: I create + call a new activity with : Intent testActivityIntent = new Intent(context, com.andy.tabletsms.work.SMSPopup.class); testActivityIntent.putExtra("com.andy.tabletsms.message", main.msgs.get(i));

onCreate always called if navigating back with intent

时光总嘲笑我的痴心妄想 提交于 2019-11-28 03:26:12
问题 I have an activity called HomeActivity that has a SurfaceView and shows a camera preview picture. This activity is quiet heavy and feels slow if you are starting/restarting it. So I made some investigations and found out, that somehow always the onCreate method is being called. In my opinion this should not happen if the Activity has already been started? The documentation says : Called when the activity is first created. This is where you should do all of your normal static set up: create

Activity restarts on Force Close

久未见 提交于 2019-11-27 21:31:11
I have an Application with a single root Activity. I've recently had it brought to my attention that any kind of Force Close on my Activity results in it restarting and I have no idea why this might happen. If I force an uncaught exception or use the 'long back press to force close' option, they both result in the same. My only guess would have been some form of quirk relating to retained references to some part of the Activity, only I don't have any outside of some WeakReference entries at the Application level. Relevant logcat entries: 05-25 08:25:49.137: INFO/ActivityManager(18449):

Prevent Activity Stack from being Restored?

拈花ヽ惹草 提交于 2019-11-27 12:05:39
When an application's process is killed, its activity stack is saved. Then when the application is restarted, all my activities resume and run into null pointers. Rather than modify every activity to accommodate this event, I would rather just have my application start with the base activity and not try to re-create the activity stack. Is this possible? I know about Intent.FLAG_ACTIVITY_CLEAR_TOP, but as I understand that will only kill activities after they have been re-created. EDIT: is clearTaskOnLaunch what I want? I've added it to my default activity, but am seeing no effect. But this

How to Control Android back stack

时光毁灭记忆、已成空白 提交于 2019-11-27 03:36:12
问题 Lets say I have A->B->C->D->E In android back stack. I want to be able to get back to one of the following: A->B->C A->B A How can I achieve this? Hopefully without forcing back button clicks. 回答1: Using the image and information from the official developers page on Android tasks and back stack you can see that of all other ways to launch an Activity you can ensure such behavior only using the FLAG_ACTIVITY_CLEAR_TOP in your Intent flags. Your regular back button proceeds as: But when you

Prevent Activity Stack from being Restored?

跟風遠走 提交于 2019-11-26 15:54:16
问题 When an application's process is killed, its activity stack is saved. Then when the application is restarted, all my activities resume and run into null pointers. Rather than modify every activity to accommodate this event, I would rather just have my application start with the base activity and not try to re-create the activity stack. Is this possible? I know about Intent.FLAG_ACTIVITY_CLEAR_TOP, but as I understand that will only kill activities after they have been re-created. EDIT: is

Android: keep task's activity stack after restart from HOME

天大地大妈咪最大 提交于 2019-11-26 14:17:34
问题 My application has two activities, that I start in this order: HOME > A > B Now I press HOME and launch "A" again. I would like to see activity "B" on a top of "A", but instead I get "A" - so the activity stack is cleared. Manifest: <activity android:name=".activity.A" android:label="A" android:alwaysRetainTaskState="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity

How to prevent multiple instances of an Activity when it is launched with different Intents

别等时光非礼了梦想. 提交于 2019-11-26 05:51:24
I've come across a bug in my application when it is launched using the "Open" button on the Google Play Store app (previously called Android Market). It seems that launching it from the Play Store uses a different Intent than launching it from the phone's application menu of icons. This is leading to multiple copies of the same Activity being launched, which are conflicting with each other. For example, if my app consists of the Activities A-B-C, then this issue can lead to a stack of A-B-C-A. I tried using android:launchMode="singleTask" on all the Activities to fix this problem, but it has

How to prevent multiple instances of an Activity when it is launched with different Intents

99封情书 提交于 2019-11-26 01:55:50
问题 I\'ve come across a bug in my application when it is launched using the \"Open\" button on the Google Play Store app (previously called Android Market). It seems that launching it from the Play Store uses a different Intent than launching it from the phone\'s application menu of icons. This is leading to multiple copies of the same Activity being launched, which are conflicting with each other. For example, if my app consists of the Activities A-B-C, then this issue can lead to a stack of A-B