android-task

Go back to MainActivity from any activities with Flag

╄→гoц情女王★ 提交于 2020-01-06 17:57:54
问题 I want to go back to MainActivity from any activities. For ex, my stack of activities: A - B - C - D. A (MainActivity) is in the bottom and D is in the top of stack . When I use android:launchMode="singleTask" . I can go back to A at any actvities as I expected. But when I use flag FLAG_ACTIVITY_NEW_TASK (without launchMode="singleTask"), it does not work as expected, it open a new Activity. And stacks are: A - B - C - D - A not as document wrote: FLAG_ACTIVITY_NEW_TASK Start the activity in

Android: How to get allowTaskReparenting=“true” to work

不打扰是莪最后的温柔 提交于 2019-12-25 02:37:12
问题 I am writing an app that can be launched from another app by receiving an intent with ACTION_VIEW or ACTION_EDIT. For example, it can be opened by viewing an email attachment. The trouble is that when you click on the home button and click again on the launch icon of the email app you were using, my activity is killed and any user edits that had been made are lost. What I want to happen is that when the user clicks the home button, my activity is re-parented so that it resumes when the user

How to preserve current back stack (or task) when notification is clicked?

断了今生、忘了曾经 提交于 2019-12-14 00:45:03
问题 In my application, I create a notification which starts Details Activity . I want to add this activity to top of current task (or back stack). For example I expect application task (back stack) to behave like this: but I get this: I have not used FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK flags. What should I do? Edit: First picture is just an example. I think the the question's title is completely explicit. I want to add Details Activity on top of current stack, and not to start

Android: When resuming app after pressing home, app always starts at root Activity

做~自己de王妃 提交于 2019-12-11 03:38:05
问题 My use case for a game looks so: I have a LoadingActivity, which loads (by AsyncTask, but this doesn't matter) and stores all the graphics needed for the game in a static class. After the loading finished, the MenuActivity appears. From this Activity I can launch other Activities like LikeBeginActivity. This is the snippet of the manifest: <activity android:name="my.domain.mygame.LoadingActivity" android:alwaysRetainTaskState="true" android:screenOrientation="landscape"> <intent-filter>

What makes a singleTask activity have 2 instances?

寵の児 提交于 2019-12-04 11:41:14
问题 As per the docs, singleTask activities can't have multiple instances. The only activity of my app is singleTask, and it has 2 instances at the same time. Steps to recreate the issue Step 1 Create a new project in Android Studio 3.3.1, Add No Activity, name it singleTaskBug, (package com.example.singletaskbug ), using Java language with minimum API level 21 without support for instant apps. Step 2 Add a new activity manually by editing AndroidManifest.xml then creating a new Java Class in app

What happens when you click on an application's launch icon?

≡放荡痞女 提交于 2019-12-04 09:15:45
问题 What happens when you click on an app's launch icon? Is a new intent always sent, or is the result sometimes the same as resuming a task from recent tasks? If an intent is sent, when does it get sent to the onCreate() method of a new activity instance and when does it get routed through onNewIntent() of an existing activity? Let's suppose the intent gets routed through onNewIntent() of an existing activity in the task. Which activity does it get sent to? The one nearest the top or the one

What makes a singleTask activity have 2 instances?

余生长醉 提交于 2019-12-03 08:11:45
As per the docs , singleTask activities can't have multiple instances. The only activity of my app is singleTask, and it has 2 instances at the same time. Steps to recreate the issue Step 1 Create a new project in Android Studio 3.3.1, Add No Activity, name it singleTaskBug, (package com.example.singletaskbug ), using Java language with minimum API level 21 without support for instant apps. Step 2 Add a new activity manually by editing AndroidManifest.xml then creating a new Java Class in app ⯈ java ⯈ com.example.singletaskbug named LauncherActivity . Content of AndroidManifest.xml :

How to fix app go to background after reorder to front and back

青春壹個敷衍的年華 提交于 2019-12-02 17:04:28
问题 I currently managed to allow user switch between two distinct acitivties groups (let's said 4 activity classes A/B group and X/Y group) and switch by FLAG_ACTIVITY_REORDER_TO_FRONT flag, but I noticed there are some strange behaviour: A ->(start activity) X X ->(reorder to front) A X , A ->(start) B ->(start) B2 A , B , B2 ->(reorder to front) X ->(start) Y X , Y ->(reorder to front) A , B , B2 X , Y , A , B <-(press back, app hide to background, B2 destroyed) B2 X , Y , A , B (click to

Show dialog activity over another app from background

两盒软妹~` 提交于 2019-12-02 01:39:21
Say you have an app A which opens up another app B (e.g. a map), which is not controlled by you (i.e. it's a preexisting app). So now app A is in the background. Suppose an event occurs and A wants to show a floating dialog over app B's UI (while leaving app B's activity visible behind it). Is this possible? (The usual answer to this would be to display a notification, but this is not a mass market app, and we are trying to get the user's attention very directly.) Currently, I was trying to do something like this: // This code runs in a class other than app A's main activity, // and the

Job Scheduler not running within set interval

萝らか妹 提交于 2019-11-30 14:58:35
问题 I'm trying to use the android Job Scheduler API and all I'm trying to do is have the Job Scheduler run every 5 seconds. However when I run it, the corresponding service is hit every two minutes. I have a log that documents every time the service is hit. I'm not sure why this is happening. Could the Job Scheduler have a minimum interval time. My code is simply... JobInfo jobInfo = new JobInfo.Builder(1, new ComponentName(this, UpdateDatabaseService.class)) .setPeriodic(5000) .build();