Android :: How To Get Root View Of Current Activity?
Jun 11, 2009Is there a function that allows me to get the top most view (the root)?
View 2 RepliesIs there a function that allows me to get the top most view (the root)?
View 2 RepliesI have a toolbar view set for most of my activities.
The toolbar has several buttons which all trigger certain intents. Now, the problem is: how can I close current activity before starting another one ?
Problem 1) Activity cones For instance one of the buttons ('A') starts activity A. Activity A also has toolbar. If you press on the 'A' button, a new A activity will be started. I suppose I can look at Activity.getInstanceCount(), right ?
Problem 2) Unnecessary activities The activity X is not needed any more if the opts for A. I just want A then. How can I remove X from toolbar which only has access to context ?
I, of course could find toolbar view inside activity X and override the onClicks, but in general this would mean doing so for all my activities !? Am I on the right track ?
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?
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
I like to know how can i clone a view object which is already there in the view hierarchy, so that it can be added to the same view hierarchy again.
View 1 Replies View RelatedI'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app. My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity. steps: Launch root activity A, press home Open email attachment, intent filter triggers launches root activity A Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?
View 1 Replies View RelatedMy app is comprised of a set of reusable Activities that other apps can reuse. For various reasons, I would like my Activities to be launched in context of the invoking Activity's process, instead of always being launched in my Activity's process (default behavior on Android). How can I achieve this?
View 1 Replies View RelatedHow 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 RelatedThe default behavior from my observation is if current activity force closes Android tries to go to previous activity on stack How can I control this behavior? I want force close to close all activities
View 2 Replies View RelatedI used Toast to make notification, but it seems it will appear even its activity is not in the current screen and some other activity has been started.I want to check this situation, when the activity is not the current one, I'd not send the Toast notification. But how to do ?
View 1 Replies View RelatedI have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.
The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.
I need to replace the current View (set by the activity.setContentView method) by an other.
View 10 Replies View RelatedstartActivity() displays the new Activity on top of the current one. But how to display it underneath instead? BTW, I'm starting an Activity from another application, if that makes a difference.
View 5 Replies View RelatedIs it possible to add an activity on top of the current activity.
For example lets say i click a button, and then it adds a second activity to the current activity. And the second activity only covers a small place at the bottom of my current activity.
I have Serviceļ¼Sometimes current run Activity work in background I don't want to know. I want to know current work interface Activity name?
View 3 Replies View RelatedHow can I know what Activity has started the current Activity? Is there any specific method like, i.e. getIntent().getCallerActivity() or the only way is saving some information within the Intent using putExtra()?
View 1 Replies View RelatedIs it possible to get the currently running activity through Service..?
i.e. I have a service started by an Activity A, and now I want to stop the service by another activty say Activity B.
Since Activity B doesnt know about the service, i want to capture the events in OnKeyDown() of the Activity B in my service...
Is this possible.. How can i get the Activity B's object..?
I want to get the current focus view in my Service to check the view is a EditText and append some texts in it (for all EditTexts, not only in my application).
I found some methods to do this, like Activity.getCurrentFocus() and Windows.getCurrentFocus(). But these methods are used in a Activity.
How can I use these methods in a Service? Or is there another way to do?
I moved out of state for college & work, and whenever I am making the 8 hour drive home people are constantly bugging me about how far I am and when I'll be arriving. I don't really like texting or talking while I'm driving, so I'm looking for an app to help me out.
Is there an application that could post my current location on google maps whenever I have the app running?
Bonus points if it could be integrated into a navigation app somehow to show my trip route and basic information (e.g. how long I've been driving and estimated time of arrival).
You guys know of anything like this? Basically I want to be able to send a url to my friends or family to monitor my location.
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 RelatedIs 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)?
I have an application which has 2 screens. When a value is changed in the second screen and when the first screen is called, the value must be updated on the button of first screen.
But I am not able to update the value on any of the widget of first screen. But I am able to see that I am getting the value, But when it comes to updating the same on button it does not happen.
I have a TabActivity class A with 2 tabs, a sub activity class B in tab 2.
Now a dialog pops up from the UI in B, once i click the save button in this dialog it goes back to the TabActivity but the tab is set to 1, however i want to set the current tab to 2 once the dialog box closed.
In short i need to acquire the tabHost reference in the diaglo when clicking on the save button.
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?
So say there's an app running (any app). I'd like to be able to get it's Activity from within a Service that will be triggered to run from a android.intent.action.SEARCH_LONG_PRESS.
Is this possible?
I am developing an application and I am displaying images from URl using xml parsing. When Internet gets disconnected I pop up alert window.
Now I want my current activity automatically reboot, when my device connect net.
I currently have a tab layout with 2 tabs, one tab with a list view and one with the option make strings so I can add them in the list view. Both tabs have their own activity because this made the code much more structured, and I dont have to repeat my self later.
Lets say im in the tab that offer me to create an string, and i press the update list button, how do I update the list view without startActivity()? If i use startActivity(), it starts List.java, and instead of displaying the list in the list view tab, it takes full screen, which defies the purpose of the tab view. In other words, the startActivity() steals the focus from the tab view of the list, and sends it fulscreen.
I want to update the activity in my list view tab, without starting a new activity that goes to fullscreen, and doesnt update the one in the tab.
I have been looking for this for a while but I can't find any way of doing it. A contrived example would be a service that simply displays the name of the current running activity as an Ongoing Notification. For instance, when the user is reading a particular email, the name of the activity (hopefully the email title!) would appear in the notifications window and when the user switches to read a text message, the notification would change to show the name of the new activity. Is there a way to do this in Android?
View 2 Replies View RelatedI am trying to save some values in the onSaveInstanceState(Bundle) method of my activty by following the example here: How do I save an Android application's state?
But it doesnt seem to load it from the Oncreate(). the bundle object is always null but whenever i call another activity, it does indeed go into the onSaveInstanceState method to save my values.
Now i read that question i just posted and someone noted how they could not get it to work in an emulator? unfortunately that is all im working on. On an emulator and cant test the app on the device as i have no device available to me right now And the web services i am interacting with are in a local VM on my work machine that cannot be accesses remotely at the moment.
My question is, is it true that saved bundles dont work on emulators? I also noticed how when i do dismiss or bring up a new activity , the activity calles onPause and then onStop. when i bring back the same activty, it goes straight to onCreate?
now according to the docs here http://developer.android.com/guide/topics/fundamentals.html#actlife That is correct in terms of what the lifecycle diagram shows but if you read below that diagram on the onStop() section it says the next step it goes into is either onRestart() or onDestroy()? no mention of onCreate? Type on the docs?
Anyways here is my onSaveInstanceState() and onCreate() both in the same activity: code...
I wanna know how to pass data from current Activity to paused Activity?
View 3 Replies View Related