FLAG_ACTIVITY_NEW_TASK is ignored, the activity is not launched on a separate stack of activities

1,679 views
Skip to first unread message

AD

unread,
Nov 9, 2010, 12:46:00 PM11/9/10
to android-platform
I'm scheduling a edit activity on a textview element on my widget like so:

 Intent intent = new Intent(context, EditStatusActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
        views.setOnClickPendingIntent(R.id.currentstatus, pendingIntent);

and changed the category for EditStatusActivity from DEFAULT to LAUNCHER:
               <activity android:name=".EditStatusActivity"
                  android:exported="true"
>
     <intent-filter>
         <action android:name="android.appwidget.action.EDITSTATUS" />
        <category android:name="android.intent.category.LAUNCHER"/>
     </intent-filter>
</activity>


with the expectation that the activity would be launched from the widget provider
pendingintent on it's own activity stack (of one).

yet when i back out of editstatus i end up on the current activity for the application.
I want the system to rid of the editstatus task and return back to the main menu.

replacing last parameter in getActivity from 0 to Intent.FLAG_ACTIVITY_NEW_TASK
results in a cancellation exception thrown upon the click on textview.
What is that i am doing wrong?

Dianne Hackborn

unread,
Nov 9, 2010, 1:49:28 PM11/9/10
to android-...@googlegroups.com
I am having trouble following exactly what you are trying to do, but I am very skeptical that NEW_TASK doesn't actually start in a new task.

You can use "adb shell dumpsys activity" to see the current global activity stack to see what is actually going on.

Also these sorts of questions are probably best directed to android-developers, since this appears to be regular SDK development.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.



--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

AD

unread,
Nov 10, 2010, 3:49:22 AM11/10/10
to android-...@googlegroups.com
On Tue, Nov 9, 2010 at 8:49 PM, Dianne Hackborn <hac...@android.com> wrote:
I am having trouble following exactly what you are trying to do, but I am very skeptical that NEW_TASK doesn't actually start in a new task.

You can use "adb shell dumpsys activity" to see the current global activity stack to see what is actually going on.


thanks, the tools clearly shows editstatus is not the front of a task
 
   * Hist #3: HistoryRecord{439521d8 biz.cactussoft.odnoklassniki/.EditStatusAc
       packageName=biz.cactussoft.odnoklassniki processName=biz.cactussoft.odno
       launchedFromUid=10022 app=ProcessRecord{43815638 532:biz.cactussoft.odno
       Intent { flg=0x10400000 cmp=biz.cactussoft.odnoklassniki/.EditStatusActi
       frontOfTask=false task=TaskRecord{438fcbc8 #8 A biz.cactussoft.odnoklass
       taskAffinity=biz.cactussoft.odnoklassniki^M
       realActivity=biz.cactussoft.odnoklassniki/.EditStatusActivity^M
       base=/data/app/biz.cactussoft.odnoklassniki.apk/data/app/biz.cactussoft.
       labelRes=0x7f050000 icon=0x7f02001a theme=0x0^M
       stateNotNeeded=false componentSpecified=true isHomeActivity=false^M
       configuration={ scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=
       launchFailed=false haveState=false icicle=null^M
       state=RESUMED stopped=false delayedResume=false finishing=false^M
       keysPaused=false inHistory=true persistent=false launchMode=0^M
       fullscreen=true visible=true frozenBeforeDestroy=false thumbnailNeeded=f
       waitingVisible=false nowVisible=true^M
       connections=[ConnectionRecord{43892e88 biz.cactussoft.odnoklassniki/.ODN
 
Also these sorts of questions are probably best directed to android-developers, since this appears to be regular SDK development.


ok, i'll keep that in mind. thanx
Reply all
Reply to author
Forward
0 new messages