¡@

Home 

2014/10/16 ¤W¤È 08:13:36

android Programming Glossary: flag_activity_new_task

resuming an activity from a notification

http://stackoverflow.com/questions/2386542/resuming-an-activity-from-a-notification

that activity is assigned to a different task as if FLAG_ACTIVITY_NEW_TASK was in the intent. you can find a detailed explanation in the..

Android: bug in launchMode=“singleTask”? -> activity stack not preserved

http://stackoverflow.com/questions/2417468/android-bug-in-launchmode-singletask-activity-stack-not-preserved

cat android.intent.category.LAUNCHER flag FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_RESET_IF_NEEDED cmp A So the result is A B HOME..

Closing several android activities simultaneously

http://stackoverflow.com/questions/2461949/closing-several-android-activities-simultaneously

mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK if used to start the root activity of a task it will bring any..

Android singleTask or singleInstance launch mode?

http://stackoverflow.com/questions/3219726/android-singletask-or-singleinstance-launch-mode

into a different task regardless of its launch mode as if FLAG_ACTIVITY_NEW_TASK was in the intent. In all other respects the singleInstance..

How to make notification intent resume rather than making a new intent?

http://stackoverflow.com/questions/3305088/how-to-make-notification-intent-resume-rather-than-making-a-new-intent

Chat.this 0 notifyIntent android.content.Intent.FLAG_ACTIVITY_NEW_TASK notifyDetails.setLatestEventInfo context contentTitle contentText.. won't need to add another activity to my stack. Get rid of FLAG_ACTIVITY_NEW_TASK . Add notifyIntent.setFlags Intent.FLAG_ACTIVITY_CLEAR_TOP Intent.FLAG_ACTIVITY_SINGLE_TOP..

How to start an Activity from a Service?

http://stackoverflow.com/questions/3456034/how-to-start-an-activity-from-a-service

since you start this outside any activity you need to set FLAG_ACTIVITY_NEW_TASK flag on the intent. For example Intent i new Intent i.setClass.. Intent i.setClass this MyActivity.class i.setFlags Intent.FLAG_ACTIVITY_NEW_TASK startActivity i where this is your service. share improve this..

Calling startActivity() from outside of an Activity?

http://stackoverflow.com/questions/3689581/calling-startactivity-from-outside-of-an-activity

from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want android alarmmanager android..

Calling startActivity() from outside of an Activity context

http://stackoverflow.com/questions/3918517/calling-startactivity-from-outside-of-an-activity-context

from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want How can I get the Context.. adapter or get it from your view or as last resort add FLAG_ACTIVITY_NEW_TASK flag to your intent myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK.. flag to your intent myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK Edit i would avoid setting flags as it will interfere with normal..

Why does starting an activity from a widget cause my main activity to start as well?

http://stackoverflow.com/questions/4535673/why-does-starting-an-activity-from-a-widget-cause-my-main-activity-to-start-as-w

Intent myIntent new Intent context EmergencyActivity.class FLAG_ACTIVITY_NEW_TASK is needed because we're not in an activity already without it.. already without it we crash. myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK context.startActivity myIntent You can see the rest of the code..

Maintaining application state in Android

http://stackoverflow.com/questions/5086985/maintaining-application-state-in-android

as what you expect. Things to look out for Don't use FLAG_ACTIVITY_NEW_TASK when launching activities. Don't use the singleTask or singleInstance..

Android: Clear the back stack

http://stackoverflow.com/questions/5794506/android-clear-the-back-stack

stack clear share improve this question Try adding FLAG_ACTIVITY_NEW_TASK as described in the docs for FLAG_ACTIVITY_CLEAR_TOP This launch.. mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK if used to start the root activity of a task it will bring any..

Clear all activities in a task?

http://stackoverflow.com/questions/5979171/clear-all-activities-in-a-task

FLAG_ACTIVITY_SINGLE_TOP FLAG_ACTIVITY_CLEAR_TASK FLAG_ACTIVITY_NEW_TASK which ensures that if an instance is already running and is..

Altering the result of getRecentTasks

http://stackoverflow.com/questions/6258980/altering-the-result-of-getrecenttasks

enable it and then start it up using an intent flagged FLAG_ACTIVITY_NEW_TASK. It will show up in the recent activities. Disable the task..

Activity stack ordering problem when launching application from Android app installer and from Home screen

http://stackoverflow.com/questions/6356467/activity-stack-ordering-problem-when-launching-application-from-android-app-inst

From the docs we see the flags are public static final int FLAG_ACTIVITY_NEW_TASK Constant Value 268435456 0x10000000 public static final int..

howto programatically “restart” android app?

http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app

Intent.FLAG_ACTIVITY_CLEAR_TOP i.addFlags Intent.FLAG_ACTIVITY_NEW_TASK MyApp.getContext .startActivity i And thats the MyApp class.. factoryReset ... The Problem now is that if I use the FLAG_ACTIVITY_NEW_TASK the Activities B and C are still running. If I hit the back.. I want to go back to the Home screen. If I do not set the FLAG_ACTIVITY_NEW_TASK I get the error 07 07 12 27 12.272 ERROR AndroidRuntime 9512..

How to correctly start activity from PostExecute in Android?

http://stackoverflow.com/questions/9118015/how-to-correctly-start-activity-from-postexecute-in-android

mContext ResultsQueryActivity.class intent.addFlags Intent.FLAG_ACTIVITY_NEW_TASK mContext.startActivity intent I added new flag because of I.. from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want Am I right android activity..

resuming an activity from a notification

http://stackoverflow.com/questions/2386542/resuming-an-activity-from-a-notification

It's the only activity in the task. If it starts another activity that activity is assigned to a different task as if FLAG_ACTIVITY_NEW_TASK was in the intent. you can find a detailed explanation in the Android Developers' Guide I hope this helps share improve..

Android: bug in launchMode=“singleTask”? -> activity stack not preserved

http://stackoverflow.com/questions/2417468/android-bug-in-launchmode-singletask-activity-stack-not-preserved

activity again ActivityManger calls an intent act android.intent.action.MAIN cat android.intent.category.LAUNCHER flag FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_RESET_IF_NEEDED cmp A So the result is A B HOME A. It's different when A's launchMode is Standard . The task..

Closing several android activities simultaneously

http://stackoverflow.com/questions/2461949/closing-several-android-activities-simultaneously

delivered to the current instance's onNewIntent . This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK if used to start the root activity of a task it will bring any currently running instance of that task to the foreground..

Android singleTask or singleInstance launch mode?

http://stackoverflow.com/questions/3219726/android-singletask-or-singleinstance-launch-mode

If it starts another activity that activity will be launched into a different task regardless of its launch mode as if FLAG_ACTIVITY_NEW_TASK was in the intent. In all other respects the singleInstance mode is identical to singleTask . As noted above there's never..

How to make notification intent resume rather than making a new intent?

http://stackoverflow.com/questions/3305088/how-to-make-notification-intent-resume-rather-than-making-a-new-intent

context Chat.class PendingIntent intent PendingIntent.getActivity Chat.this 0 notifyIntent android.content.Intent.FLAG_ACTIVITY_NEW_TASK notifyDetails.setLatestEventInfo context contentTitle contentText intent mNotificationManager.notify SIMPLE_NOTFICATION_ID.. resume it and therefore not needing to load it again and won't need to add another activity to my stack. Get rid of FLAG_ACTIVITY_NEW_TASK . Add notifyIntent.setFlags Intent.FLAG_ACTIVITY_CLEAR_TOP Intent.FLAG_ACTIVITY_SINGLE_TOP see this sample project . Context..

How to start an Activity from a Service?

http://stackoverflow.com/questions/3456034/how-to-start-an-activity-from-a-service

so you can use startActivity directly. However since you start this outside any activity you need to set FLAG_ACTIVITY_NEW_TASK flag on the intent. For example Intent i new Intent i.setClass this MyActivity.class i.setFlags Intent.FLAG_ACTIVITY_NEW_TASK..

Calling startActivity() from outside of an Activity?

http://stackoverflow.com/questions/3689581/calling-startactivity-from-outside-of-an-activity

android.util.AndroidRuntimeException Calling startActivity from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want android alarmmanager android pendingintent runtimeexception share improve this question..

Calling startActivity() from outside of an Activity context

http://stackoverflow.com/questions/3918517/calling-startactivity-from-outside-of-an-activity-context

to launch a new activity. I get the exception Calling startActivity from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want How can I get the Context that the ListView the current Activity is working under android.. question Either cache context object via constructor in your adapter or get it from your view or as last resort add FLAG_ACTIVITY_NEW_TASK flag to your intent myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK Edit i would avoid setting flags as it will interfere.. or get it from your view or as last resort add FLAG_ACTIVITY_NEW_TASK flag to your intent myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK Edit i would avoid setting flags as it will interfere with normal flow of event and history stack. share improve this answer..

Why does starting an activity from a widget cause my main activity to start as well?

http://stackoverflow.com/questions/4535673/why-does-starting-an-activity-from-a-widget-cause-my-main-activity-to-start-as-w

Intent intent ... new Emergency .emDialog context .show Intent myIntent new Intent context EmergencyActivity.class FLAG_ACTIVITY_NEW_TASK is needed because we're not in an activity already without it we crash. myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK.. is needed because we're not in an activity already without it we crash. myIntent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK context.startActivity myIntent You can see the rest of the code at http code.google.com p emergencybutton source browse..

Maintaining application state in Android

http://stackoverflow.com/questions/5086985/maintaining-application-state-in-android

standard behavior which is what it sounds like you are describing as what you expect. Things to look out for Don't use FLAG_ACTIVITY_NEW_TASK when launching activities. Don't use the singleTask or singleInstance launch modes. Don't see the clearTaskOnReset flag...

Android: Clear the back stack

http://stackoverflow.com/questions/5794506/android-clear-the-back-stack

A. How can I avoid this android android intent android activity stack clear share improve this question Try adding FLAG_ACTIVITY_NEW_TASK as described in the docs for FLAG_ACTIVITY_CLEAR_TOP This launch mode can also be used to good effect in conjunction with.. described in the docs for FLAG_ACTIVITY_CLEAR_TOP This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK if used to start the root activity of a task it will bring any currently running instance of that task to the foreground..

Clear all activities in a task?

http://stackoverflow.com/questions/5979171/clear-all-activities-in-a-task

Yes that should work fine. You could use FLAG_ACTIVITY_CLEAR_TOP FLAG_ACTIVITY_SINGLE_TOP FLAG_ACTIVITY_CLEAR_TASK FLAG_ACTIVITY_NEW_TASK which ensures that if an instance is already running and is not top then anything on top of it will be cleared and it will..

Altering the result of getRecentTasks

http://stackoverflow.com/questions/6258980/altering-the-result-of-getrecenttasks

with affinity equal to the empty string. In your program enable it and then start it up using an intent flagged FLAG_ACTIVITY_NEW_TASK. It will show up in the recent activities. Disable the task and it disappears from the display. Make enough of these and..

Activity stack ordering problem when launching application from Android app installer and from Home screen

http://stackoverflow.com/questions/6356467/activity-stack-ordering-problem-when-launching-application-from-android-app-inst

is using 0x10200000 . It is also using an intent category. From the docs we see the flags are public static final int FLAG_ACTIVITY_NEW_TASK Constant Value 268435456 0x10000000 public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED Constant Value 2097152 0x00200000..

howto programatically “restart” android app?

http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app

etc. Intent i new Intent MyApp.getContext A.class i.setFlags Intent.FLAG_ACTIVITY_CLEAR_TOP i.addFlags Intent.FLAG_ACTIVITY_NEW_TASK MyApp.getContext .startActivity i And thats the MyApp class public class MyApp extends Application private static Context.. static Context getContext return context public static void factoryReset ... The Problem now is that if I use the FLAG_ACTIVITY_NEW_TASK the Activities B and C are still running. If I hit the back btn on the Login Activity I see C but I want to go back to the.. If I hit the back btn on the Login Activity I see C but I want to go back to the Home screen. If I do not set the FLAG_ACTIVITY_NEW_TASK I get the error 07 07 12 27 12.272 ERROR AndroidRuntime 9512 android.util.AndroidRuntimeException Calling startActivity..

How to correctly start activity from PostExecute in Android?

http://stackoverflow.com/questions/9118015/how-to-correctly-start-activity-from-postexecute-in-android

asynctak After this in PostExecute Intent intent new Intent mContext ResultsQueryActivity.class intent.addFlags Intent.FLAG_ACTIVITY_NEW_TASK mContext.startActivity intent I added new flag because of I have got in LogCat the next Calling startActivity from outside.. flag because of I have got in LogCat the next Calling startActivity from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want Am I right android activity android asynctask share improve this question You should..