Development : Calling Activity Get Destroyed / Remain In Pause State?
Mar 19, 2009
When another activity is started from main activity, The main activity get destroyed and created when returned back from second Activity main activity remains in pause state till second activity finish (), on Sart or on Resume from when returned back from second activity? which one these case does happen in And roid application?
View 3 Replies
Aug 18, 2010
I have one query. In Home Application the timer is running and if any ANR or Alert or Notify come then this home activity would go in Pause state but timer is running and visible. How it is happening. Can anybody explain me how this work.
View 4 Replies
View Related
Jun 14, 2010
Suppose i have a program that' s currently in a PAUSED state. Then the user launches another activity. In this second one, i want to find if the first one is in paused state or not because, if its paused, i want to recover it.
Is there a way to find if a specific activity is in pause state or not?
View 6 Replies
View Related
Mar 27, 2010
I have an AsyncTask object which starts executing when the activity is created and does stuff in the background (downloads upto 100 images). Everything works fine but there is this peculiar behavior which i'm not able to understand.For eg: when the android screen's orientation changes then the activity is destroyed and created again. So I override the onRetainNonConfigurationInstance() method and save all the downloaded data executed in the AsyncTask. My purpose of doing this is to not have AsyncTask run each time activity is destroyed-created during orientation changes, but as i can see in my logs the previous AsynTask is still executing. (The data is saved correctly though)I even tried to cancel the AsynTask in the onDestroy() method of the activity but the logs still show AsynTask as running.This is really strange behavior and would really be thankful if someone can tell me the correct procedure to stop/cancel the AsynTask.
View 1 Replies
View Related
Sep 24, 2009
I press program's icon to start my program,and then open the Settings activity through startActivityForResult(intent, SETTINGS). Now i press the home key and start my program through program's icon, at this time the Settings actitity will run OnDestroy() and be destroyed. I can't understand why Settings activity is be destroyed automatically? How can I make Settings activity still focus when users come back. Code...
View 7 Replies
View Related
Sep 19, 2010
Being an Android newbie experimenting with GPS stuff I managed to put together this code and it works just like I expect it to except for one thing, the GPS icon never goes away. How can get the GPS icon to disappear when the activity is destroyed? I have code...
in my onPause() but apparently that's not enough?
The problem exists in the emulator and also on my HTC EVO with 2.2. On my EVO, the icon stays there when the activity is destroyed and only disappears when I uninstall the app. code...
View 1 Replies
View Related
Apr 18, 2010
I have tried to freeze orientation: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
But thought screen stays in portrait orientation, the activity is still recreated.
View 1 Replies
View Related
Jun 30, 2010
I want to do some cleanup in a view when the activity is being destroyed. Is there any way to get a callback in the View when the activity is being destroyed? I tried using onDetachedFromWindow, but I'm not sure whether it is correct thing to do.
View 1 Replies
View Related
Apr 13, 2010
I'm trying to place a call with Intent.ACTION_CALL and a tel uri including pauses and dtmf codes to be sent when the call is established (i.e. tel:+1777777777,,,,,,,,,,5555555).
Android strips all the special characters and place the call to the rest of the uri (i.e. tel:+17777777775555555)
Any workaround?
I'm testing it with HTC Hero (1.5)
View 4 Replies
View Related
Nov 19, 2010
I wrote an android program that: has a main activity for UI, and it starts a service. The service timely callbacks the UI activity to update views. It works fine except: if the activity is closed (with BACK) and start again, the service will also be started again (The service plays audio file, so there are two overlapped sounds). I use bindService with BIND_AUTO_CREATE flag to start and connect to service. According to the document, it should create service only if it doesn't exist, but obviously it starts another instance when opened second time. All I want is when the activity is closed, the service goes on running, and when the activity opens again, it can reconnect to the service. Is that possible? Or I just misunderstand the usage of service?
View 1 Replies
View Related
Nov 9, 2010
I need to develop an application with downloads the data at the background and update about the progress in the front.
I guess this can be achieved using services and activity and passing data in between the. But, what I need to do is even if I hit back button and then start the activity again. It should check if the service is running or not. If service is not running it should start one else it should display the data from running service.
Something like music player where music is played by a service at a background and activity displays the information. Even on browsing through other activities of the application or hitting back, state of the music player is maintained.
View 1 Replies
View Related
Jul 1, 2010
I have a service that is listening for some events. When that event happens, it fires a screen by start Activity(intent) When the user finishes doing something on that screen, the code calls finish() but instead of 'closing' the complete application, is shows the main/launcher activity. any way to go around this?
View 1 Replies
View Related
Jul 9, 2010
I have a Contact Activity which is derived from ListActivity, which displays list of contacts, and on click of item, a new Activity Message Activity derived from ListActivity is initialized.Now I know, I can pack some information in Bundle and pass it before creating activity, but is there a way I can get instance of "ContactActivity" in onCreate method of "MessageActivity"?
View 1 Replies
View Related
Nov 30, 2009
I see no means by which my activity can pop itself off the activity stack to return the user to the one he was using before it was invoked. Is there one? My purpose is that my app has some data structures built from data provider queries that take 5-15 seconds to assemble and I don't want a lot of latency if it is used in a few one-shot purposes in rapid succession. I'm more than willing to let the system ask my app to die, but I'd like to keep warmed and ready otherwise.
View 4 Replies
View Related
Jan 20, 2009
How to pause and resume the activity?
View 3 Replies
View Related
Jun 9, 2010
I have* two activities*,
*1st one* has a ques and 4 options.
*2nd one* is like a result page (... displaying if your ans is correct or not ...and showing the right ans ..)
Now what i want is when a user clicks :
on a right option [or wrong option] ..i want to turn that Image button into green [ red] .*.and wait for a while* ..and then go to the result activity ..
*so my only concern is onclick of a ImageButton ... how to wait for a while .. and then move to other activity* * * any kind of suggestion will do ..
View 4 Replies
View Related
May 11, 2010
I'm start a new Activity B from Activity A, and find launch Activiy B is very slow, cost over 3000 Milliseconds, and when i click "back" to Activity A, then i found this log below:
CODE:....................
Activity B only contains a ListView with CursorAdapter.
Any idea how does this happen? this performance is unacceptable.
View 2 Replies
View Related
Sep 10, 2009
Just wondering is it necessary to close cursor when an activity is stopped or pause?
View 5 Replies
View Related
Jun 30, 2010
I'm trying to write a game engine in Android, but I don't have much familiarity with threads.
My thread has an attribute, mSurfaceHolder, which holds the surface that I'll be drawing to. The run() method for my thread looks like this:
CODE:.............
STATE_RUNNING represents the state when the activity is in the foreground and the game should be running.
STATE_PAUSED represents the state when another activity has come into the foreground. I'm not completely sure why I need to still draw while it's paused, but that's what I seem to have gathered from the LunarLander example.
What I'm hoping is that while I'm looking at the activity, the game will update and draw (which I test by using LogCat). And then when I go back to the home screen or another activity appears over the top, it will just draw.
Well it does draw and update while I'm watching the activity, so the game loop itself works. But when I leave the activity, it has no effect. Here is the thread's pause() method that is called from the activity's onPause():
CODE:.............
As you can see, to test this method I have logged some messages. Now what I find when I leave the activity is that "Here" is logged, but "There" is not. Now with my limited knowledge of threads (I hardly know what synchronized actually does), I believe this will happen because my thread can't get synchronized with the surface holder. But I don't know WHY it doesn't synchronize. A few seconds after I've left the activity, I see the following warning in LogCat:
Activity pause timeout for HistoryRecord
Any idea why this would happen? There are no problems if I try to start the activity again, the thread just keeps running as it was.
Just discovered something else. The thread pauses just fine if I leave the activity within about a second of having started it. And then it will resume and pause again with no problems at all while the same task is still running. I have no idea why for a short period of time it will work, but if I leave it too long, it won't.
Okay... I fixed it. But I don't think I'm supposed to do what I've done. I've basically removed any synchronization with mSurfaceHolder from both the pause() and the setState() methods (which is used by pause()). No it works as it's supposed to, but I'm thinking the synchronization is there for a reason.
Perhaps the best question for me to ask is this: WHEN should you synchronize a thread with an object by use of a synchronized block? And in this case, what is the purpose of synchronizing with the SurfaceHolder?
View 1 Replies
View Related
Aug 7, 2010
I am experimenting with using a WebView to display Flash content inside my activity. Everything is working pretty well, but when the user hits the home key to put the activity into the background, the Flash content keeps running (sound keeps playing, etc)
I have noticed that both the stock Android browser and Dolphin Browser seem to avoid this problem, and properly pause the Flash content when the browsing activity is put into the background.
Ideally I would like a solution that kills the WebView completely if the activity is finishing, but pauses it otherwise (basically copying the default behavior of the browser)
Here is a simple test I put together that loads a game on Kongregate which has some background music:
CODE:..............
I took a look at the latest source for the stock browser, and it seems to be doing something similar (calling pauseTimers/resumeTimers), although I fear the code I have been looking at is out of date, because it is calling functions that don't seem to exist anymore.
I did verify that the call to pauseTimers is working by testing with a simple JavaScript setInterval which updates a counter. Is there something else obvious that I should be trying in regard to Window or View management?
The documentation for the mobile Flash player says:
Flash Player will also automatically pause SWF playback it is not in view or the foreground application, for example when a call is received or alarm goes off, to reduce CPU utilization, battery usage and memory usage.
This seems to be working perfectly in both the stock browser and Dolphin Browser, but not in my app. Any ideas/solutions would be greatly appreciated!
Update: Here is the function we ended up adding to our activity to get this to work. We call it with "onPause" in the activity's onPause function and "onResume" in the activity's onResume function:
CODE:....................
View 2 Replies
View Related
Jul 15, 2010
onCreate, MyActivity will display five TextViews. After you touch one of the five TextViews, it will hide three to four TextViews and color one red and one green or just color one green.
I can code everything up to here. But how can I pause for a few seconds and then repopulate the five TextViews with new values, unhide them and make them all white?
I tried a Timer in a new project and can attach the code and make my question less vague.
Here is the main.xml
CODE:................
Here is the TestTimer.java
CODE:.....
The issue is that the Timer executes resetAndContinue and logs two entries, but it doesn't set the TextView color from green to white and it doesn't log anymore
CODE:.............
View 1 Replies
View Related
Jan 15, 2010
I have an application that launch a thread when a ToggleButton is pressed, but if I press the home button, a new activity is started (I can return to the first activity if I press the back button), but I want to recovery the first activity launched state, which have the reference of the initial thread.
This is my code:
org.test.test.java:
////////////////////////////////////////
package org.test;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.ToggleButton;
[code]....
View 5 Replies
View Related
May 17, 2010
I am trying to make a task switcher and i succed in it. My only problem is that when I launch activities, they are relaunched as they were new activities ( for instance, I am writing an email, i press home and go into my activity,launch email, and then the app launch the email bout goes back at the inbox and the email is lost) So that's not true multitasking.
View 2 Replies
View Related
Nov 22, 2010
I want see the state of my activity (Pause Stop Resume etc etc) without override each methods like this: Code...
View 3 Replies
View Related
Jan 22, 2009
In an ActivityUnitTestCase I'm trying to do:
CODE:...............
But on the save state call I get this trace:
CODE:.................................
Going through the ApplicationContext source code I've found this (http://tinyurl.com/d8qsyc):
CODE:...................
It seems the problem is that the activity token is not set. But here I'm puzzled, I don't know where to go next. Any ideas on how to fix it or workaround it are appreciated. I want to test that my application is saving its state correctly.
View 3 Replies
View Related
Jul 1, 2010
I have an Activity, which contains a bunch of check boxes and a submit button.
When the submit button is clicked, the activity will exit (finish() will be called). Before the activity exits, I want to save the states of the check boxes in the activity, so when the activity starts again, the check boxes can stay in their previous states. What's the correct way to save these states? Should I use SharedPreference.
View 1 Replies
View Related
Dec 7, 2009
I have a TabActivity subclass that attempts to start a new activity via a menu item selection in onOptionsItemSelected.I am receiving the following exception which eludes me at the moment.I'm not sure why it thinks I am *not* in an activity!
View 2 Replies
View Related
Nov 19, 2010
i am writing an app in which i need a background service to call an activity and show some result.
View 4 Replies
View Related
Apr 4, 2010
me and my partners are working on developing a pwa client for android Am getting an error while calling an activity from another activity.the error is as follows...
View 3 Replies
View Related
May 6, 2010
I m currently working on landscape mode for android app in which i want to know how to maintain the state of the activity and views displayed on orientation change i.e from portrait mode to landscape mode ?
View 3 Replies
View Related