Android :: How To Give Focus To A Background Activity Belonging To A Different Task

Aug 4, 2010

Say that the user has started my App and then switched off to use the Browser (so we have 2 sets of Tasks running). After a while, something happens to my app that requires the user's attention, so it posts a notification to notify the user. Is there a way to bring my App's task (and the Activity on top of the stack) out from the background when user clicks on my notification?

Android :: How to give focus to a background Activity belonging to a different task


Android :: Give Text View Focus / Want Briefly With Example?

Aug 27, 2009

How can we give text view focus?

Tell briefly with example.

View 3 Replies View Related

Android : Way To Give Background Color To Textview In Droid?

Dec 1, 2009

how to give background color to textview in android?

View 2 Replies View Related

Android Background Running App Focus?

Mar 15, 2012

i am using fileobserver to observe the changes in a folder.Now i want to get focus on my application UI when i create a new file inside that folder(observed). i am able to create event on creation of new file in that folder. But not able to get UI of my application in front.

View 2 Replies View Related

Android :: Custom Listview Background Focus State Not Working

Jun 18, 2010

I am trying to create custom background selector for my ExpandableListView. It works fine for all states other than focused. I am unable to identify which row is currently focused. Here is the code...

View 2 Replies View Related

Android :: Schedule Background Task?

Jan 14, 2010

There seems to be a couple of ways to go about having a background task being executed. My usecase is to have my app fetch a datafeed every x minutes, regardless of my gui is running, and regardless of whether the phone is sleeping or not. I use an alarmmanager to schedule an intent matching a broadcastreceiver. in the onRecieve method i start a service (startService), which spawns an AsyncTask. The task fetches data and stores it and then stopSelf() the service.

in the onRecieve method i aquire a PARTIAL_WAKE_LOCK, before starting the service, and just before calling stopSelf() in the service, i release it again. Is this really the best way to do it? Do i even need the service in this scenario? I experience odd behaviour with this setup, where the setup works for hours and then suddenly stops, which makes it very hard to debug. Does anyone have a simple foolproof method to achive the same end?

View 1 Replies View Related

Android :: How To Manage Background Task

Nov 9, 2010

I have a task which I need to run in the background in my Android app. It reads data over the network and populates a database. It can take several minutes to run.

Once it's started, it needs to complete successfully without interruption. (Otherwise I'll end up with a broken half-populated database.) I realise I can never guarantee it will always complete, but I want to make it as hard as possible for the system to kill off this task. For safety I guess I will have it populate a temporary database, and then only swap out the old database for the new one on successful completion of the import.

It's a modal operation; it does not make sense for the user to be interacting with the app while the import is in progress.

My first attempt is using an ASyncTask with a Progress dialog to achieve the modality, but this obviously breaks the "don't interrupt" requirement. I could work around the screen-rotation issue with ASyncTasks, but I don't think that goes far enough.

At the moment I'm not sure if this should be an ASyncTask, a Service, an IntentService, some combination of these, or something else entirely.

View 2 Replies View Related

Android :: Set Focus On Running Activity

Mar 24, 2010

I have an Activity that keeps running after the Home button is pressed (naturally) and of-course the focus is in the home screen, and when the running process ends I need to restore the focus on that activity. In more PC expression, I need to maximize the application.

View 1 Replies View Related

Android :: Reliable Repeating Background Task?

Aug 31, 2009

I'm trying to run a background task which runs every minute or so for an android application but I am struggling to ensure that the task actually runs every minute. I've tried a variety of approaches from using SystemClock.sleep() to the AlarmManager (both repeating alarm and a fixed alarm) but it seems that unless the device is charging any kind of repeating system has a variable repeat rate once the device is unplugged. Is there any way to run a stable consistently repeating service?

View 2 Replies View Related

Android :: Activity With Two Elements - Input Focus

Oct 12, 2009

I have an android activity, with two elements:
EditText
ListView
When my activity starts, the EditText immediately has input focus (flashing cursor). I don't want any control to have input focus at startup. Stop EditText from gaining focus at Activity startup? I tried:
EditText.setSelected(false);
No luck. How can I convince the EditText to not select itself when the Activity starts?

View 5 Replies View Related

Android :: How To Find Out When Activity Starts Or Get Focus?

Mar 17, 2010

I would need to know when one activity starts or get's focus. I need this notification for any activity regardless of his type, name or whatever - not searching for one specific activity. Checked the ActivityMonitor and the Intent and I haven't found a generic intent for this purpose. Or I hadn't understood well the descriptions from the Intent ACTION_xxxxx.

View 7 Replies View Related

Android :: Moving Focus To Top Of Activity - Scrolling

Aug 26, 2009

I have an activity that begins with almost a page of text, then has a few form controls. When the activity launches, the first form control takes focus and the screen scrolls down to make it fully visible. When this happens, the text at the top is off the top edge of the screen. When the screen comes into view, I want the text at the top to be visible. So, onCreate, I tried sending a message to the Activity's overridden handler to do the following:

ScrollView main = (ScrollView) findViewById(R.id.main);
main.pageScroll(ScrollView.FOCUS_UP);
This did nothing. I then tried:
main.scrollTo(0,0); This also did nothing.
I then tried sending the message from onResume instead of onCreate. This also did nothing. How to force the scrollview to actually scroll?

View 3 Replies View Related

Android :: How To Tell Inbox Activity Focus His Rows?

Nov 3, 2009

I know the title it doesn't explain my problem exactily. It's better explain it with an example. I want put up-down arrows over inbox activity. I can select each row in the inbox message list pressing up or down arrow. I'd tried it showing two activities at time starting a new thread, but I can't get it. However, if I could put my arrows another problem appears: how can I tell inbox activity focus his rows? Then, I thought maybe I resolve my problem installing NDK, but I have a lot of problems installing it. Finally, you could think, another solution could be manage myself inbox message list; but this is not an scalable solution for me.

View 4 Replies View Related

Android :: Set Focus On TextView When Activity Starts?

Aug 16, 2010

There are an EditText and a TextView in my Activity. I want to set focus on the TextView when the Activity starts. I used the following code:

TextView myTextView = (TextView) findViewById(R.id.my_text_vew);
myTextView.setFocusable(true);
myTextView.setOnClickListener(this);
myTextView.requestFocus();

But the code doesn't work. The EditText always receives focus when the activity starts.

View 1 Replies View Related

Android : Remove Focus From Current Activity

May 26, 2010

How would i remove the focus from an activity which has just being installed/started,

so the user's focus will remine on the previous one?
(while the new activity remine in the stack and will work in the background)

the prob is that when i start this new background activity, until i wont press back or home, the ui is stuck. and i would like to fix that some how?

View 1 Replies View Related

Android :: Start Activity When Main Activity Is Running In Background

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

Android :: Best Way To Logout Each Time Application / Task Goes To Background?

Jul 16, 2010

I have an application which requires a login at the beginning (this is the first activity). When the user logs in, I keep his credentials in the application (I extended android.application to add a field called 'key'). I would like to clear this field from memory (from application instance) an go back to the login activity.

I see the following possibilities: - Add a broadcast receiver to catch all possible event (call, click on menu, click on back, lock the phone ...) which clear the key field and launch the login activity - Use clearTaskOnLaunch for all activities except the login activity. But then until my application takes the focus again the key stays in the application object. (It seems it doesn't work with the go back button, maybe I need to use no history also) - Detect for each activity in all onPause or onStop events when application will leave the foreground to clear the key field and launch the login activity

The best would be to have a kind of OnPause method at application level but I think it doesn't exist.

View 9 Replies View Related

Android :: Stop Timer When Activity Loses Focus

Nov 10, 2010

I have a Timer which executes a TimerTask every 30 seconds. I only want the timer to launch a new TimerTask if the Activity is displayed i.e. if the user receives a phone call or launches a new activity the Timer will stop. I then need the Timer to restart when the Activity is re-launched and comes into focus.

Now this should be easy, I override the "onWindowFocusChanged(boolean hasFocus)" method and either start or stop the timer depending on the value of has Focus. The way I start the timer is to create a new Timer object and TimerTask each time and the way I stop the Timer is to call the cancel() method on the Timer object and set timer to null.

My problem is this doesn't always work, if I launch the activity which has the Timer and switch orientations quickly (to start/stop the Activity) I find the Timer is not always canceled and I end up with multiple Timers launching TimerTasks at an ever increasing rate.

View 2 Replies View Related

Android :: Detect When Another Activity Is Launched Or Loses Focus

Dec 3, 2009

Like the title says, I need to detect when my app loses focus because another app is launched (Phone call comes in, or user hits Home etc.).
Overriding Activity.OnStop does not work because that is called even when switching activities within my app.

View 3 Replies View Related

Android :: Googlemaps View Activity Regain Focus

Nov 24, 2010

I have a problem with my app, it haves a lot of activitys, two of them haves googlemap views. My A activity haves a full mapview and my B activity haves a small map view. OK, when i am on the B activity and press back key somethimes until i return to my A activity, the map of my A activity shows with errors, with a black zone in the down part of the window. THis only happens when i press back from the B activity. Code...

View 1 Replies View Related

Android :: Specify Which Item Gets Default Focus On Activity Startup?

Apr 11, 2009

How can you specify which item gets the default focus on Activity startup? Using requestFocus programmatically does not work. On setContextView the first focusable item listed in the XML is given the default focus. When using RelativeLayout, the first item listed is not always the desired item or necessarily on top.

View 3 Replies View Related

Android : How To Ensure View Isn't In Focus When Activity Starts?

Oct 2, 2009

I open an Activity which has a number of elements... some TextViews, some Buttons, and an EditText. For some reason, when the activity starts, the EditText is focused by default, which causes the keypad to appear hiding the screen. I only want this EditText to be in focus if the user clicks into it. How can I ensure that this View isn't in focus when the activity starts? I've tried calling requestFocus() on one of the buttons, but it hasn't changed anything. Ideally, I don't want anything in focus at all.

View 7 Replies View Related

Android :: Apps Still Running In Background With Advanced Task Killer

May 5, 2010

When I kill tasks in ATC and then hold the home button, it still shows apps running. What's up with that?

View 10 Replies View Related

Android :: Update All Contacts Belonging To One Group

Sep 28, 2009

I have an application that updates all the contacts belonging to a group, I currently do the following : -> Get the group id -> Get all the contacts id inside this group -> For each of them I am doing an update on the contact => This is really heavy and seems to take time in real phones while I expect it to be "instantaneous". I am wondering if we can, in the ContentResolver.update() method specify a kind of join. For instance I'd like to do something like : UPDATE <people> SET <people.name>="<new name>" FROM People p, Groups Memberships gm WHERE p.person_id=gm.person_id and gm.group_id=<my_group_id> Does anyone know if it's possible or not? The update method has got a "where" attribute but can we use this attribute for complexe requests?

View 3 Replies View Related

Android :: Detect Screen Not Belonging To App Comes Into Visibility?

Aug 26, 2010

I have an application that has many screens. Is it possible to detect if the screen NOT belonging to the application (not defined in my android manifest) comes into visibility?

View 1 Replies View Related

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.

View 2 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 :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

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

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android :: Background Task / Progress Dialog / Orientation Change / Any 100% Working Solution?

Sep 29, 2010

I download some data from internet in background thread (I use AsyncTask) and display a progress dialog while downlaoding. Orientation changes, Activity is restarted and then my AsyncTask is completed.I want to dismiss the progess dialog and start a new Activity. But calling dismissDialog sometimes throws an exception (probably because the Activity was destroyed and new Activity hasn't been started yet).What is the best way to handle this kind of problem (updating UI from background thread that works even if user changes orientation)? Did someone from Google provide some "official solution"?

View 1 Replies View Related

Android :: ASync Task Progress Dialog Not Showing Until Background Thread Finishes

Apr 24, 2010

I've got an Android activity which grabs an RSS feed from a URL, and uses the SAX parser to stick each item from the XML into an array. This all works fine but, as expected, takes a bit of time, so I want to use AsyncActivity to do it in the background. The line items = parser.getItems() works fine - items being the arraylist containing each item from the XML. The problem I'm facing is that on starting the activity, the ProgressDialog which i create in onPreExecute() isn't displayed until after the doInBackground() method has finished. i.e. I get a black screen, a long pause, then a completely populated list with the items in. Why is this happening? Why isn't the UI drawing, the ProgressDialog showing, the parser getting the items and incrementally adding them to the list, then the ProgressDialog dismissing?

View 3 Replies View Related







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