Android :: Get Foreground Activity Displayed On Screen
Apr 22, 2009
Is it possible to get listed the apps or activity which are actually displayed on the screen of the android mobile. I need to display a text box on some event when no acitivity is displayed, excepting the home screen.
View 3 Replies
Mar 31, 2010
I was wondering if anyone understood how to make your application be displayed when you unlock the screen. I have an application where the user turns on a Bluetooth device, it connects to the phone, and the user should be presented with a UI. Having them hunt for the app or using the notification menu is not a workable option (too much work and not the obvious behavior).
The problem is that:
When the screen is unlocked:
- you can popup the activity from the background service when Bluetooth connects to a device
- User is happy because the UI is right there
When the screen is locked:
- The application gets started but is destroyed
- User unlocks the phone and nothing is there but the homescreen
One work around would be to disable the keyguard when the application gets woken up but the nuclear option is a pretty bad option. I know the standard Android assumption is that you shouldn't do this. In the normal case this behavior is fine, but in this case I explicitly did something I want the phone to respond without adding more work for the user to do. As per Google's guidelines if you don't like this behavior there can be an option for you to turn this off or you can not use the application.
A few more details, so after looking at this a bit more the problem isn't necessarily that you can't have an activity running when the screen is locked, unlock and expect it to be waiting. That does work if you do something like the following: lock your device run an app through Eclipse while the phone is locked/off unlock and it will be waiting for you.
But in the case the Activity is already running and I'm brining up a new window (which happens to be a transparent one, saying you're connected and asking what they want to do).
The problem is that it gets killed
CODE:..................
The setup here is as follows:
MyBackgroundService is a serivce that handles Bluetooth state (waits for connections, turns on Bluetooth if the user starts the app, etc.). It triggers a popup BackgroundPOPUP activity that runs a ViewFlipper.
MyBackgroundService starts BackgroundPOPUP through an intent.
BackgroundPOPUP is an activity with a Translucent theme (Theme.Translucent to be precise), it shows a ViewFlipper with some instructions and presents some options.
View 1 Replies
View Related
Apr 9, 2009
Step 1: I am subclassing WebView and rendering html content properly. The intial content is very small with a div and image /link This is displayed in a LInear Layout along with a TextView and ListView. That is my first screen/activity of the application.
Step 2: When I click on a link on this webview, it goes through the webViewclient and expands to full screen to fit the content of the requested page.
After Step 2, I am not able to go back to my activity screen once the content is displayed. When I click on the back button to getback to my activity screen close my activity and goes to the phone's applications desktop. (i.e goes out of my application).
Step 3: In order to fix this issue, I stopped setting my own subclasssed WebViewClient. After doing this, the it seems to render the clicked page in a webView as subactivity. Now When I click on backbutton, it goes back to the activity screen. But, the issue now is, I am not catch event when a link is clicked. How can I catch click events in this case.
View 2 Replies
View Related
Mar 3, 2009
Who knows how I can make Activity visible from invisible process? .....
View 2 Replies
View Related
Apr 22, 2010
Is there a way to call startActivity(Intent) without the newly started activity displacing the current one as the active, foreground activity?
If not purely so, are there near approximation to this effect that can be done, such as mimicking a back keypress event right after calling startActivity()? If so, which means is preferred?
View 5 Replies
View Related
May 2, 2010
I'm getting the outgoing number using BroadCastReceiver and then starts a Activity. but my activity runs in the background??? how can i bring it to foreground? ...
View 5 Replies
View Related
Oct 6, 2010
I want to write a service for Android platform that is notified when the current foreground activity changes. Basically the service should do some tasks only when the top activity changes. Is there any way to subscribe and to be notified when this kind of event occurs? Or there is no possibility and the service should poll from time to time the list of running activities and to check what is the foreground activity ?Not preferable solution...
View 1 Replies
View Related
Oct 6, 2010
Is there a native android way to get a reference to the currently running Activity from a service?
I have a service running on the background, and I would like to update my current Activity when an event occurs (in the service). Is there a easy way to do that (like the one I suggested above)?
View 2 Replies
View Related
Feb 17, 2010
Maybe it's easy, but I couldn't really figure this out right so far... I got a BroadcastReceiver waiting to get triggered by the AlarmMangager - this works fine.
Now: because the event, if it occurs, needs to refresh some elements on screen of the main Activity, I would like to send an Intent from that background BroadcastReceiver to my Activity - but only if it is currently in the foreground, aka active.
If it is not running or not visible, I don't care - and the last thing I want to do is start the Activity by my intent! I handle repainting of the views in my onResume method, so I don't care at all.
EDIT: my BroadcastReceiver is waiting for alarms that must be notified to the user. So, it must be there and declared in the manifest. The problem is: it will have to decide whether the mentioned Activity is currently up in front or not.
View 3 Replies
View Related
Feb 9, 2010
I defined an activity ExampleActivity.
When my application was launched, an instance of this activity was created, say it is A. When user clicked a button in A, another instance of ExampleActivity, B was created. Now the task stack is B, A, with B at the top. Then, user clicked a button on B, another instance of ExampleActivity, and C was created. Now the task stack is C, B, A, with C at the top.
Now, when user click a button on C, I want the application to bring A to the foreground, i.e. make A to be at the top of task stack, A, C, B.
View 4 Replies
View Related
Sep 22, 2010
How to bring stop activity to foreground (restart) by itself?i use Broadreceiver and intent to restart my activity.but always start two activity (include original activity)how to restart my original activity?
View 4 Replies
View Related
Mar 29, 2009
I launch my TestWebView activity. After my web page is loaded, I put the app in the background by pressing the Home key. Then I bring the TestWebActivity back to the foreground. Unexpectedly, TestWebView's onCreate() is called when I bring the activity to the foreground. But onDestroy is never called. This same thing happens every time I tested. It appears the old TestWebView was not completely killed so there are possibly duplicate web clients running.
My code: .....
View 7 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
Jul 6, 2010
I have a function that needs a Surface object to work. I'd like to be able to call that function from a background Service without starting a foreground Activity. Every Surface source in the API that I can see, though, requires a View that's laid out before the Surface becomes available. Are there other ways to create a Surface that I am missing, and can you point me to them?
View 5 Replies
View Related
Jul 21, 2010
I'm trying to figure out a way to send touch events to the foreground activity. Essentially I want to write something that allows me to run it from the shell and just say "I touched this co-ordinate", so that I can automate some UI tasks for testing. Essentially what Monkey does, but application agnostic.
I think that android.view.MotionEvent holds the key, but I'm not sure how to run something without view so that I don't interfere with what is on the screen. Perhaps with a service, but I'm unclear how that would work.
View 5 Replies
View Related
Sep 25, 2010
My Activity is running on the foreground and my Activity is getting pushed to background when I hit on the home button... I am trying to display the pop up at certain intervals, in this case as my activity is running on background when I try to display the pop up but thats not shown on the foreground.
View 1 Replies
View Related
Feb 4, 2010
I currently have an application that naturally gets pushed to the background when the home key is pressed.
The activity losses focus but continues running in the background.
So I want to know is it possible to bring the application back to the foreground when the user presses the green key (call button) on the device?
View 3 Replies
View Related
Jul 24, 2010
The recent apps display seems to function quite differently from earlier versions on 2.2. Try the following for instance: 1) Open an app 2) Click on something that takes you to another activity in the same app 3) Press the home button 4) Press and hold the home button to get the recent list of apps - select the app you chose in step 1 5) You'll be taken to whatever activity in that app is specified as the main/launcher Activity, rather than the Activity on top of the stack (as it was previously) It makes it appear to the user that the application has exited when the home screen button was pressed. I don't have my app set to clear history on launch or anything like that, and I can replicate it on the emulator and with any app on my device (Contacts, Gmail, Engadget etc) Anyone else notice this? Anyone know any reason for the changes? I must admit I quite dislike the new method.
View 10 Replies
View Related
Feb 28, 2010
My app has 2 activities - A and B. From homescreen I launch A, from A I launch B. The activity stack looks like this: A-B. Now I press HOME button, and from homescreen click again on my app icon, which launches A and adds it on top of the activity stack, which now looks like this: A-B-A. But I just want to bring my application to foreground, is that possible in Android?
View 2 Replies
View Related
Nov 12, 2010
I'm struggling with my app that launches multiple instances of the same Activity using the same intent. My main activity is of class type A and it does a startActivity() of two children that are of the same class type B. So we have B1 and B2 launched. If B1 and B2 are both paused (by pushing back button and making sure finish() is not invoked on them so they are truly paused), how can A uniquely bring either B1 or B2 to the foreground again? I do want to launch a new B activity. I want to uniquely bring B1 or B2 to the foreground.
so both B1 and B2 were created like this... Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);
Now I want A to bring B1 (or B2) to the foreground/front so I use the below code, but how do I distinguish B1 or B2 when starting the activity? This only brings the last instance of B that was on top to the foreground.
Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);
I've tried keeping around references to B1 and B2 and doing something like this, but this also only goes to the last instance of activity class B that was on top...
Intent intent = new Intent(B1context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); B1context.startActivity(intent);
I even tried this, but it still doesnt get me my unique B1 or B2... Intent intent = B1.getIntent(); // i.e. the original intent that started me startActivity(intent); // still only brings to front the last B that was on top.
View 3 Replies
View Related
Apr 9, 2009
When MountService received event from HAL and start a notification, it would display an AlertActivity after user's click. However, I found the AlertActivity is created and can't be displayed.
I got some log as below:
CODE:........
Is it related to "FLAG_ACTIVITY_NEW_TASK"? however, how to solve it?
I've tried to use "launchmode as singleTask", but is doesn't work.
Is there anyone give me a hand? Why my activity can be created but can't be displayed?
View 3 Replies
View Related
Aug 19, 2010
I have some activities and I have to display a fullscreen ad image before displaying the activity... all my activities extends a custom activity and I thought it was a great idea to implement that advertisement there, so I did: code...
This works nice... the ad is displayed for 3 seconds and it closes automatically. The problem is that the activity that should be hide for the ad is being created faster, so the user can see it for a second before the ad is created. How can I avoid that behavior? How to make sure the ad activity starts before the another does?
View 1 Replies
View Related
Aug 20, 2009
Is there any way for a backfround task to programmatically detect or recognize by learned id which application or screen (different package) is showing?
View 5 Replies
View Related
Aug 21, 2010
I have a splash screen/loading screen that has .setVisibility() to GONE right after the draw call of my large bitmap is completed. The problem is the splash screen takes a bit to popup which i believe is due to the main activity booting up and doing CPU intensive applications on first run. Is there a way to get my splash screen displayed ASAP? Would it be ok if i had it in a different thread maybe? The splash screen is just a bitmap with a progressBar right below it. My layout is xml based so i cant see myself using setContentView.
View 2 Replies
View Related
Sep 22, 2010
Will i get charged for having the weather displayed on the main screen?
View 9 Replies
View Related
Aug 5, 2010
Using Google Maps on Android does anyone have any ideas on how to load only markers that would be displayed on the current screen? I'm thinking about sending a request to a web service that returns the lat/lng for the relevant markers. But what would the parameters be that I could use to calculate if a given lat/lng is within the screen?
View 1 Replies
View Related
Jul 15, 2009
I want my Toast to be displayed at specific points on the screen. How do i do that?
View 3 Replies
View Related
Oct 26, 2010
I have written the code for geocoding..but unfortunately it does not work ie nothing is displayed on screen...i am attaching the code...is the fault in the code..
CODE:.............
View 1 Replies
View Related
Dec 16, 2009
We are developing an application that requires a download of a music file (mp3). We are using the Browser Activity for the same.
The Browser Activity is invoked from the application and the download url is passed to it, like: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(downloadurl)));
However, after downloading, on the download list page, if we press the Back button, a blank white screen is displayed. Only after we press the Back button a second time on this white screen, the application screen is displayed. This happens because the Browser Activity view is displayed before the actual downloading starts.
This is an issue in the application flow. We need to manage the flow in such a way that the 'Back' key press on the download list view will take the control to the application screen instead of the white screen.
View 3 Replies
View Related
Feb 15, 2010
Today I am looking for a way to mimic the behavior I know from my HTC Hero's lock screen: the calendar and alarm clock can put text & drawables there to inform about an upcoming event or an expired alarm. The lock screen remains there in that it must be dragged down to dismiss the shown event and there might also be a Snooze button.
But, first question: is this default Android stuff or HTC Sense specific only??
Second question: If it is a common Android thing, why can't I find anything in Google's Android documentation for the topics "lockscreen" or "lock screen" that comes close to my question? Where's the API for it?
My problem is: I want to inform the user immediately - even if I try a standard notification, the user with a locked screen will have to unlock it and drag down the notifications list to see & clear what's going on. sigh Putting an endlessly playing notification sound there is a hassle as it takes at least two swipes down to stop the sound playing!
View 2 Replies
View Related