Android :: How To Detect If Current Stack Of Activities (task) Moves To Background?

Jul 23, 2010

The official documentation describes tasks as follows: All the activities in a task move together as a unit. The entire task (the entire activity stack) can be brought to the foreground or sent to the background. Suppose, for instance, that the current task has four activities in its stack three under the current activity. The user presses the HOME key, goes to the application launcher, and selects a new application (actually, a new task). The current task goes into the background and the root activity for the new task is displayed. Then, after a short period, the user goes back to the home screen and again selects the previous application (the previous task). That task, with all four activities in the stack, comes forward. Is there a way to programmatically detect when the task of the current Activity moves into and out of the background? I would like to know when the user has switched switched to another application, vs. when the user navigated to another Activity in the current app.

Android :: How to detect if current stack of activities (task) moves to background?


Android :: How To Clear Current Activities In Stack?

Jul 26, 2010

Support App starts activity A, then A starts activity B and finishes itself. After that activity B starts activity C. Now the stack contains B and C, with C at the top. Then I click a button in activity C, and want it to clear B and C and start activity A, i.e. I want activity A to be the only activity in the stack. How can I make it?Edit: I made a test to use FLAG_ACTIVITY_CLEAR_TOP. But it didn't work in my case, because activity A is not running when button in activity C is clicked.

View 1 Replies View Related

Android :: Determining Current Foreground Application From Background Task Or Service

Jan 30, 2010

I wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running. So my questions are: How I should run my application in the background. How my background application can know what the application currently running in the foreground is.

View 4 Replies View Related

Android :: Blocking Current Activity / Screen Till Current Task Is Complete

May 13, 2010

The default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options

View 12 Replies View Related

Android :: How Do I Clear All Activities From Stack?

Jul 8, 2010

I am having trouble popping all activities off the stack using ntent.FLAG_ACTIVITY_CLEAR_TOP and android:launchMode="singleInstance". In my application activity A, launches activity B (via startActivity) which in turn launches activity C (via startActivity). On activity C the user presses a menu item to return to activity A. When they arrive at activity A, I want only A on the stack such that if they click the back button they return to the home screen (desktop). This is the code that I am currently using when the user presses a button to return to A: Intent i = new Intent(this, A.class); i.addFlags(Intent.FLAG_ ACTIVITY_ CLEAR_TOP); startActivity(i); All activities are defined as android:launchMode ="single Instance" in the project manifest. My code doesn't seem to work though. Once I'm back on activity A if I click the back button I return to activity C. Am I misunderstanding how to use Intent.FLAG_ACTIVITY_CLEAR_TOP?

View 2 Replies View Related

Android :: How To Reopen A Stack Of Activities?

Sep 3, 2010

My App is Launched by "Main.java" (Activity) and opens a Notification and a second Activity called "Sub.java", now I press the Home-Button and the App disappears (everything okay until here). If I'll now click on the Notification the "Main.java"-Activity is launched, the "Sub.java" seems to be lost. Is there any possibility to reorder the Stack of Activities to the front?

View 1 Replies View Related

Android :: How To Keep Track Of Activities In Activity Stack

Aug 23, 2010

I need to keep track of currently existed Activities in Activity stack.

Can any one help me in that how to do it programmatically?

View 1 Replies View Related

Android :: Kill Sub Activities And Bring Activity To Top Of Stack

Aug 4, 2010

I have activity A that starts activity B which starts activity C

A -> B -> C

When a user clicks on a button in activity C, i want to bring A to the top of the stack and take B & C completely out of the stack. Is there a way to do this ? ?

View 2 Replies View Related

Android :: Way To Tell When Task Goes To Back Of Stack?

Mar 23, 2009

Is there a way to tell when my task gets put on the back of the UI stack (user pressed "home" say?) I have some resources I'd like to free when not foregrounded. The lifecycle routines seem dicey to use to try and infer this. The "home" key does not seem to be passed to onKeyDown(), and moveTaskToBack() is never called by the system so I can hook it. I can poll the ActivityManager for running activities with my task id, but hard to find a good time to call this.

View 5 Replies View Related

Android :: Way To Visualize Activity Stack (activities In Memory) On Droid?

Jun 26, 2010

I'm currently debugging my app which is quite complex and has up to 5 activity levels. In order to detect memory leaks (i.e. activities that aren't removed from memory even finish() is called, due to some references held somewhere) I want to check which activities are still alive in memory. Currently I create hprof dumps, but it's not very convenient, cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc. (Side note: I already tried to automate the pulling of my hprof file more easily, but I'm on an unrooted device and adb pull <hprof file> won't let me / no permission.) Therefore I am wondering, if all I want to know is IF and WHICH activities are still currently alive in my memory, is there a way through the Android API or any other way on-the-fly with which I can achieve this (list all alive activities of my app), programatically.

View 2 Replies View Related

Android :: How To Clear Activity Stack In Task

Jan 6, 2010

I have three activities. Activity A start activity B by the method startActivityForResult, and Activity B start activity C by the method startActivity. Then, after starting activity C, activity B kill himself by finish(). Now the task stack stored two activities: A and C. My question is: how can I finish activity A when I finish activity C. or how can I clear the whole stack of the task.

View 5 Replies View Related

Android :: View Task's Activity Stack

Mar 14, 2010

I just started developing a simple Android application while I'm still learning its platform. I'm using Eclipse IDE with the ADT plugin 0.9.6 and I need to know if it's possible to view the activity stack that is associated with a Task. Is there any way through the DDMS tool or through any other technique?

View 4 Replies View Related

Android :: Keep Task's Activity Stack After Restart From Home

Jan 13, 2010

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:always Retain Task State = "true">What should I do?

View 2 Replies View Related

Android :: Odd Behaviour With Launcher's Task Stack Handling

Aug 6, 2010

I have an application with two activities, A and B. A is the root activity, which then starts B.When the stack looks like this: HOME > A > B and I select A from the launcher, I want it to resume the task without clearing the stack, so B is shown. Right now this is mostly working. However. In certain circumstances this occasionally does not work. What we see in this situation is that invoking A from the launcher will create a new instance of A and add it to our task's stack: HOME > A > B > A If we go back to home and select A again, we'll get another one: This happens if, and only if, we uninstall the application completely using the application manager, and then reinstall it, via a file browser. Installing the application with adb does not cause this problem to appear.In addition, when this problem manifests, if we then reboot the device, the problem goes away and everything starts behaving correctly! This is smelling suspiciously like a launcher bug can anyone shed light on this? This is using Eclair on real hardware (not the emulator).Update I have more information. It seems this is an Android core bug; see http://code.google.com/p/android/issues/detail?id=5277 in the Android bug tracker. Apparently running an application just after it's been installed by pressing the 'Run' button will run the application in a subtly wrong way. It's also still extant on Froyo, not just Eclair. Does anyone have any suggestions as to any possible workarounds?

View 1 Replies View Related

Android :: Task Activity Stack Always Reset When Launched From Home

Mar 24, 2009

I am just starting on an Android app and I am puzzled about why my Task activity stack is being reset any time the application is launched from the Home screen. I used the ADT tools to create the application in Eclipse. The main activity is ".UserLaunch" and it starts the activity ".About" when the user presses a button. If the user then presses HOME and then relaunches the app, .UserLaunch is displayed and is the only thing on the stack.

.UserLaunch has the launchMode singleTask. .About is standard. According to the documentation at http://developer.android.com/guide/topics/fundamentals.html#lmodes: "However, a "singleTask" activity may or may not have other activities above it in the stack. If it does, it is not in position to handle the intent, and the intent is dropped. (Even though the intent is dropped, its arrival would have caused the task to come to the foreground, where it would remain.) "The Task stack should be brought to the foreground and .About should still be displayed. I added Logging to all of the lifecycle events (edited to remove timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see that when HOME is pressed, .About cycles through onPause and onStop (as expected). Then when the app is again launched, .About is destroyed and .UserLaunch is restarted D/UserLaunch:(670): onCreate() D/UserLaunch:(670): onStart() D/UserLaunch:(670): onResume() I/ActivityManager(52): Displayed activity com.cequint.cityid/.UserLaunch: 4910 ms I/ActivityManager(52): Starting activity: Intent { comp= {com.cequint.cityid/com.cequint.cityid.About} } D/UserLaunch:(670): onPause() D/About(670): onCreate() D/About(670): onStart() D/About(670): onResume() I/ActivityManager(52): Displayed activity com.cequint.cityid/.About: 1031 ms D/UserLaunch:(670): onStop() I/ActivityManager(52): Starting activity: Intent { action=android.intent.action.MAIN categories= {android.intent.category.HOME} flags=0x10200000 comp= {com.android.launcher/com.android.launcher.Launcher} } D/About(670): onPause() D/About(670): onStop() D/dalvikvm(670): GC freed 413 objects / 34128 bytes in 72ms I/ActivityManager(52): Starting activity: Intent { action=android.intent.action.MAIN categories= {android.intent.category.LAUNCHER} flags=0x10200000 comp= {com.cequint.cityid/com.cequint.cityid.UserLaunch} } D/About(670): onDestroy() D/UserLaunch:(670): onRestart() D/UserLaunch:(670): onStart() D/UserLaunch:(670): onResume() Here is the relevant section of the Manifest: <application android:icon="@drawable/icon" android:label="@string/ app_name"> <activity android:name=".UserLaunch" android:label="@string/app_name" android:launchMode="singleTask" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".About" android:launchMode="standard"> </activity> </application> Anyone have any ideas why this is always resetting the Activity Stack?

View 11 Replies View Related

Android :: How To Get The List Of Activities Within A Task

Jun 16, 2009

Is there a way to get the list of activities (all of them) for a ActivityManager.RunningTaskInfo

View 2 Replies View Related

Android :: Detect Current Screen Vertical Or Horizontal?

Jun 3, 2009

I need to set different content view after rotating device screen. Is there any method to detect the direction of current screen is vertical or horizontal?

View 6 Replies View Related

Android :: Detect Widget Active In Current Panel?

Nov 6, 2009

how to detect the Widget in home screen is active in the current panel? As you know, some device has many panel i.e (HTC Hero has 7 panel), each panel can put some widgets on the home screen, then the widget will run and refresh the data automatically, we want to let the widget disable the refresh data feature while it is not under current panel. and enable it while it is put to current panel again.

View 7 Replies View Related

Android :: How To Clear Android Stack Of Activities?

Nov 16, 2010

Hi I have an application with several Activities in Android and I want the user to be able to log out by pressing a menu button. The problem I have is that A) Android doesn't let you terminate the applications and B) even when I send the user to the Login Activity again they can always press back and get right back to the previous activity they were in.I already tried to launch the Activity with the two following flags:
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
I also tried with each one of them by themselves. I also tried calling finish() after startActivity(intent) as I read in another StackOverflow

View 2 Replies View Related

SetContentView Of Activity Within Activities Current View?

Feb 17, 2012

So I have my main activity. It starts out adding a custom SurfaceView called DrawView as the content view with

DrawView drawview = new DrawView(parameters);
this.setContentView(drawview);

now my layout.main.xml is a layout with a video view which I am using to play my cutscenes. I am able to switch to this view by calling a method I made which switches the content view by

this.setContentView(R.layout.main);

which works fine when I am calling this method within the Activity. Only problem is I need to call this method from within DrawView! The method I made to switch to my cutscene is public and I do pass the Activity (named Draw) as a parameter of DrawView.

So when I do call this method from within DrawView my game freezes and will subsequently crash! however it works when method is called locally?

View 3 Replies View Related

Android :: Activity Not Started Its Current Task Has Been Brought To The Front

Sep 23, 2010

I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online.

CODE:..................

View 3 Replies View Related

HTC Desire :: Unable To Detect Current Time Zone

Jun 28, 2010

I seem to get this error message daily 'Unable to detect your current time zone', does anyone else get this?

View 5 Replies View Related

Android :: Finish Any Previous Activity In Stack From Current Activity?

Apr 27, 2010

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity?

View 1 Replies View Related

HTC EVO 4G : Want Calendar Widget On Homescreen With Days Current Activities?

Jun 7, 2010

Is there a way to have a calendar widget on the home screen with the days current activities? I saw it on one of the scene layouts.. I think it was the work one but I want to use the sprint scene and add that widget. Is this possible? Also, is there a to do list or task list app built in or do I need to download one. If I do have to download one are there any recommendations.

View 1 Replies View Related

Android :: How To Detect An Activity Goes Into Background

Aug 5, 2010

I need a way for my Activity to known that it's going into the background, and not when it's getting killed. I thought about hooking at onStop(), but onStop() is called for both cases. In other words, is there a way to tell if when my Activity is moving into the background and not getting killed?

View 2 Replies View Related

Android :: Click On Status Bar Notification Switch To Task In Current State?

Aug 16, 2009

My applications carries on processing when the user presses the home key, and generates status bar notifications if something happens the user requested to be notified about.

If a user holds the home key and then selects the application, it is restored in its correct state with the activity on top that showed when the user left.

However, since the intent that is associated with the status bar notification is FLAG_ACTIVITY_NEW_TASK and I put in the class name of the activity that launched the application (I assume this is what I must do?), the launcher activity is started when the notification is "clicked". I can then switch the application back to the current activity by starting that "active" activity again, but then I seem to have two instances of the activity in memory, since I have to press back twice to leave it. And I suspect my activity stack is then messed up as well.

I have set the launcher activity to be singleTask, but that only helped a bit. From my reading I thought this would just give the task focus if the launcher activity is not on top, but instead it gives the launcher activity the focus.

Is there a way for a notification click to work more like the task switcher provided by long pressing the home button?

View 10 Replies View Related

Android :: Close Activity Hierarchy In Droid / Show New Not Present In Current Task?

Sep 26, 2010

How do I close a whole hierarchy of activities and show a new activity not present in the current task?

Context

Consider a FTP browser that resumes the previous session on launch. Each folder is displayed in its own activity. When I click on a folder, a new activity is started for the folder. If I press the back button, the app returns to the previous activity, which corresponds to the the parent folder.

I can logoff from the menu at any time. Logging off should bring me to the login activity (not present the current task when the app has resumed the session), and close all the other activities. How can I do this?

From what I've read, if the activity were in the current task I could use FLAG_ACTIVITY_CLEAR_TOP in the intent, but this is not my case.

View 1 Replies View Related

Android :: ActivityManager - Warning -Activity Not Started Its Current Task Has Been Brought To The Front

Aug 25, 2010

CODE:..........

Here is the code where the problem lies....

It doesn't give me an error it says exactly this when I run the android emulator

"[2010-08-25 09:12:42 - doppler_test] ActivityManager: Warning: Activity not started, its current task has been brought to the front"

What I think this means is that the intent of the bluetooth function and the button intent is only operation on a hierarchy system. What I mean by this is that if I were to move the button opperator above the Bluetooth stuff the button will work, but currently when the app is run Bluetooth works but when I press the search button nothing happens.

What else may be helpful is my XML code for the button so here it is......

CODE:..........................

View 1 Replies View Related

Android :: Can Background Activities Execute Code?

Jul 15, 2010

Are Activities in the background considered "running" (and can execute code) or are they in a suspended state?

View 1 Replies View Related

Android : How To Detect Launch Of An App In Droid From A Background Service?

Mar 3, 2010

I want to create an app or background service that just listens for the launch of a 'default' app, say Contacts or the built-in Gmail app. If the contact app is clicked, I want to transfer control to my app temporarily (e.g. present a Yes/No popup to the user or increment an internal counter of my app ) and then redirect the user back to the app that was clicked. I want to do this only for a couple of 'well-known' built-in default apps, not any third party apps..

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved