Android :: Activity Background Processing
Apr 17, 2010
"Note that when you write an activity, you can make it stop or continue running when it is moved to the background (see onStop() in Activity Lifecycle). For activities that download data from the network, it's recommended to let them continue downloading so the user can multi-task." As far as I was aware I had to create a service if I wanted to have a background activity such as a media player, internet download, or processing of data in files on the SD card continue when the activity was no longer in the foreground.I went and reread the onStop information on the "Activity Lifecycle" page, which was referred to. But I didn't find any mention of how an activity might continue to run in the background after onStop was called.
View 3 Replies
Nov 6, 2010
I've a problem with my android application.
I'm using a background service (with notification on the status bar) which performs an audio sample every hour. To perform this sample I generate a broadcast event every hour and when I capture the event the audio recording starts. During the day, when I'm using the phone, I've no problems. The strange behavior happens during night, when it seems like if the phone goes to an "idle" state: the broadcast events are no more processed. From the log file I understood that the events are generated and putted in a queue... and when I start using again the phone, all those events are raised in the same moment.
Do u have any idea about how to solve this problem? How can I force the phone to continue processing my events? do I have to set any variable of flag to avoid the phone going in this kind of "idle" state?
View 1 Replies
View Related
Jan 10, 2010
I created an application which enables the user to set whether he wants to receive notification while the application runs in background mode. If the notifications are enabled an activity should be started (the dialog should appear on the screen).
I tried to enabled it the following way:
CODE:...........
This is the method from main activity. When onPause() is executed isRunningInBackground is set true.
When I tried to debug it when the main application was running in the background the line
startActivity(intent) had no effect (the activity didn't appear).
Does anyone know how to midify the logic in order to start an activity from the main activity when the main activity is running in the background (after onPause() is called)?
View 1 Replies
View Related
Nov 19, 2010
Is there a way to 'preload' a user interfaces but to not display it until I am ready?
I have a service which has a receiver to listen for action_screen_on to occur. When that occurs, I would like to load an activity. However, as it is now, it takes about 1 second to load. I would like to preload the layout in advance so that when the screen is turned on the layout loads as soon as possible.
View 2 Replies
View Related
Jun 23, 2010
How to change background of activity and background of the application name at the top of your activity?
View 2 Replies
View Related
Nov 19, 2010
i have set the background of an activity with a green gradient png image.This working fine almost always but some times during navigating to an activity its background is becoming black! i am not able to reproduce it with any specific operation, also not getting how to debug or fix it.
View 3 Replies
View Related
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
Jul 14, 2010
Has anyone any idea on how to solve the generic problems related to starting a task in background from an activity and when the task is finished posting the result to the activity that created ? (the activity might get destroyed in the meantime due to a orientation change ,or receiving a call , or might be in the process of destroying and recreation)
View 2 Replies
View Related
Aug 4, 2010
Is it possible to start an Activity in the background? I need such an Activity that can operate in the background and spawn other Activities as needed in response to user commands issued to my Home Screen widget.
View 1 Replies
View Related
Jul 22, 2010
Using theme or ImageView ?
View 2 Replies
View Related
Jan 31, 2010
When i launch Activity A, the screen goes black, then dark-gray. Then A launches B, and the screen goes black and dark-gray again. Is there a way to set the default background color to black? Activity A has no screen, its just a stub that calls B.
View 4 Replies
View Related
Apr 22, 2010
My use case is writing an overlay controller activity for a landscape camera preview. I followed the instructions from a couple of tutorials for writing a transparent theme.When I start this activity from my root activity, the layout gets drawn correctly, but the background stays black. I tried to use @android:style/Theme.Translucent instead, but this Theme inherits the orientation from the calling activity (landscape) and thats not what I want.The application holding the camera preview is set to landscape view as it does not display the preview correctly in portrait orientation. (see old google bug report)What I wanted to do was to put an independent activity for user interaction interface in front of the camera surface holder (this activity should be set to 'portrait', or even better to 'sensor')
View 3 Replies
View Related
Sep 9, 2010
I'm not very familiar with the android SDK yet. I have an application (game), which is developed mainly using the NDK, and uses egl to render. i have an activity which handles the egl swapbuffer and runs the games native main loop, pretty straight forward I guess.
Now I have made another activity which host a TableLayout containing an EditText as well as a button (simply for text-input later used by the game). I spawn this activity from my main activity using startActivityForResult. The small problem I'm having now is that I can't manage to make this "popup" activity to have a background, so my paused game will reside in the background, with the various widgets just overlaid. This is not very pretty in my opinion, and I would like to at least have a solid background color for my spawned activity while it's active. I *could* just simply go into some state in the games main loop which clears the gl-screen just before I spawn the new activity. But I don't like this solution and it's a tad more work then I'm prepared to put in just at this time in the project. I'm pretty sure there is some simple way to just set a background color somehow, I just can't find *any* way to do it, I've looked around in the SDK resources and tried to search for any hints towards this, but i'm just not familiar enough with the java SDK to find what i'm looking for.
On a side note I would also like to be able to center the EditText widget as well as the button on the screen once the Activity is active, I haven't looked very deeply into it yet, but from a quick glance of the documentation I couldn't really find any suitable positioning methods in the tablelayout class. But as I said, haven't looked very hard. Can probably solve that one easy, but i'm just throwing this in as well :)
View 2 Replies
View Related
Jan 11, 2010
How can i make an activity go to background without calling its finish() method and return to the Parent activity that started this .I tried so much but it really dint help.So if you guys could help i would be very thankful.
View 2 Replies
View Related
Sep 15, 2010
I have next problem, I have got parent activity and few sub- activities, if app goes to the background by pressed HOME button for long time, all children will be killed, and my app restart from parent activity.
For example: A1 - parent, A2,A3,A4 - sub-activities. A1-->A2-- >A3(top), from A3 I go to the background (HOME). wait 30-40 min and
View 7 Replies
View Related
Sep 7, 2010
How can I get background color and text color (default for child views) of an Activity in Java?
View 1 Replies
View Related
Sep 12, 2010
I am a bit confused on creating an image which will be acting as a background for my activities. So, in short, my aim is that my application should be able to fit the different screen sizes. Therefore, what size in pixel should my three images be to be able to fill the screen of the device in ldpi, mdpi and hdpi?
View 2 Replies
View Related
Oct 12, 2010
My goal is to develop a GUI application on top of a background image with buttons in specific places on the image. The first step is to display the background.
The image can be displayed with resources and is described in several FAQs including this one:
how-to-add-background-image-to-activity
It compiles and runs without errors, but the background is black. Here is the main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/rootRL" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
</RelativeLayout>
The image has been in png, 9.png, and jpg format with basenames of 'main' and 'background'. It builds but does not display. Making clean and recompiling does not help.
This behavior occurs on both the emulator and on hardware -- an Atmel AT91SAM9M10-G45-EK. The SDK version is 2.0.1.
View 1 Replies
View Related
Nov 13, 2009
I want to develop a application that continuously running in background as service. And after that if i press any numeric key, it should start an application.
I have developed a service which is running continuously. Is it possible in Android?
View 2 Replies
View Related
Mar 17, 2010
I am aware my issue is against the philosophy of Android, but I have no choice, this application will run on a embedded car gps and I need to bring an activity to prevent from car accident, for example, when it's happen around the user. I have to put other activity on the back and bring my alert pop up without user manipulation like notification on the front. Is there a way to bring manually an activity to the front, by resuming it like when you click on the android task switcher?
View 2 Replies
View Related
Mar 18, 2010
I am trying to create a simple Android application that has a ActivityList of information, when the application starts, I plan to start a Service that will be constantly calculating the data (it will be changing) and I want the ActivityList to be in sync with the data that the service is calculating for the life of the app. How can I set up my Activity to be listening to the Service? Is this the best way to approach this problem? For example, if you imagine a list of stock prices - the data would be being changed regularly and need to be in sync with the (in my case) Service that is calculating/fetching the data constantly.
View 3 Replies
View Related
Apr 6, 2010
i've developed an android app that's fetches an xml file and displays this data via several markers on the map. This works fine so far. The problem right now is that when i switch the orientation of the phone (portrait->landscape or vice versa) the markers disappear for a small moment, the xml processing is started again and then they reappear. Is there a way to prevent this re-loading of the file? It only takes about 2-3 seconds.
View 2 Replies
View Related
Jul 27, 2009
1)Which is better for developing a game.
a)Using XML layouts
b)Using Custom layouts with Surface view
2) while making a custom view using Surface view... do we need to have a secondary thread to implement the surfaceholder.callback()......
My code below does not show the activity in grey background as i have coded... do i need to use the unlockcanvas and all ,,but i havent used the secondary thread
CODE:..............
View 2 Replies
View Related
Aug 5, 2010
I create an application which displays the notification when the service starts. If an user navigates to HOME screen (without exiting the application), the user could still go back to the previous application by pressing on the notification icon. This is very similar case as the track recording service in Google application "My Track".
I want the existing activity as Single Top activity since it has associated service running. However when my application tries to bring the existing activity to front via notification, the existing activity's onDestroy has been called which causes problem. How can I skip this onDestroy method? Here is my current codes:
CODE:............................
View 2 Replies
View Related
Oct 31, 2010
My app's main activity listens to a broadcast message. When it receives the message it brings the activity to the front. I want to update the activity if it is in the front, so the user is playing with it, but otherwise I do not want to bring the activity to the front. How should I do it? Is there a flag for invoking the intent, or what?
View 4 Replies
View Related
Apr 28, 2010
What happens on Activity.finish() with an AsyncTask still running in background?
Does it just pop the Activity off the Activity Stack, but wait to destroy the Activity object until the AsyncTask fully completes (since the AsyncTask is an inner class of my Activity)?
Also, would it act any differently if the AsyncTask were a public, non-inner class that held no references to the instance of the Activity?
View 1 Replies
View Related
May 28, 2010
I am switching activities on tab clicks and successful at this. But, in one of my Activity class I am doing the following:
CODE:.............
I want to change the background of this layout only and I want tabs to their as it is. But with the currentandroid:layout_height="fill_parent"in main.xml my background is overwriting the tabs which means I am unable to see tabs. and If I makeandroid:layout_height="wrap_content"` I cannot see any change taking and tabs are still their.
View 2 Replies
View Related
May 28, 2010
I am switching activities on tab clicks and successful at this. But, in one of my Activity class I am doing the following:
CODE:........
main.xml has the following:
CODE:...........
I want to change the background of this layout only and I want tabs to their as it is. But with the currentandroid:layout_height="fill_parent"in main.xml my background is overwriting the tabs which means I am unable to see tabs. and If I makeandroid:layout_height="wrap_content"` I cannot see any change taking and tabs are still their.
View 1 Replies
View Related
Oct 10, 2010
I need my Android app to save it's state to disk when its activity is put in the background or killed. It's been suggested that I start a thread when onPause() is called and perform any expensive I/O procedures there (see http://stackoverflow.com/questions/3894668/saving-loading-document-state-quickly-and-robustly-for-image-editor).
In what situations will the OS kill the thread and how commonly do these situations occur?
I assume it will be like how Activities are dealt with where the OS can arbitrary decide to kill the thread but will mostly only do this when resources are extremely limited. It would be nice to find some specific documentation of this though.
From playing around, with some test code, a background thread started in onPause() will run indefinitely in the background on my device (I tried loading lots of apps and couldn't get it to be killed).
For my specific app, I'm writing a bitmap editor where I'm using the Command pattern and the Memento pattern to allow undo and redo of edits. I'd like the user to be able to undo/redo their edits even e.g. the user gets a phone call and the activity is killed when it is put in the background. The best solution I can think of is to use a background thread to constantly save my command and memento objects to disk during application use and to finish up saving any objects that are left in a background thread if onPause is called. In the worse case, if the thread is killed I'll only lose some edits.
View 3 Replies
View Related
Oct 19, 2009
In my application i wait on socket for network events.On some events i have to bring activity into foreground(make activity as running) if at all it is not in the foreground.
View 17 Replies
View Related