Android : Inside TabActivity / How To Get Instance Of Current Tab Activity?
Apr 23, 2010
I have attached a menu to my TabActivity, and when a menu item is selected, I would like to do something different based on which view is being currently displayed in the TabHost.
int getCurrentTab() returns me the id of the current tab... but from that int how can I get the instance of the activity running?
I also tried getCurrentView(), getCurrentTabView(), but these return things I can't seem to cast to the class of the current activity.
View 3 Replies
Oct 1, 2010
I would like to access the public method of an Activity run by a TabActivity using: Code...
Basically, what I what is to let the parent Activity call a method in child Activity in order to do something. Is this possible?
I did try this:((TeamHuddleScreenMsgsView)getTabHost().getCurrentTabView().getContext()).refreshModel(); but I'm encountering a ClassCastException. It seems that the getContext() still gives the TabActivity. Any help on how to get the child Activity?
View 2 Replies
View Related
Aug 21, 2009
I wanna put a "List" inside a TabActivity. by google and coder's guide, my work out "direction" is to create a "TabActivity" as MAIN and "ListActivity" then add it in the "TabHost" and turn out code something like (below) and fail:
CODE:.........
I know i may need to spend more time on the BOOK and google for android development, but i also feel that the resource for android is quit scattered and not detail. (i'm a developer of C# for a few years, and it's more easilier to search for information)
View 2 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
May 13, 2010
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
View 12 Replies
View Related
Mar 13, 2010
I have a TabActivity, each tab holds an activity. At some point I'd like to 'refresh' the tabs. I'd basically like to restart each activity in the tabs. I'm not sure how to do this. Calling:
CODE:.........
Removes the tabs, but the activities still seem to be in alive, in limbo. How can I get them to really quit?
View 2 Replies
View Related
Jun 28, 2010
I am trying to figure out the best practice of communication between a TabActivity and the child activity embedded in this TabActivity.
In my TabActivity, there is a button. When the button is clicked, I want the child activity embedded in this TabActivity to be updated. I wrote the code like below, and just wonder whether it is a good practice.
CODE:..................
View 3 Replies
View Related
Dec 29, 2009
I am developing an application and as part of it I would like to show a tabactivity and use the contact activity to let the user see,modify,or call a specified contact.
My code is this:
CODE:..........
View 3 Replies
View Related
Jul 30, 2010
My TabActivity contains two tabs which calls two two different activities . I want to setResult() for the TabActivity when either one of the child finishes.
Is there any method to find out when my activity inside tab finishes?
View 4 Replies
View Related
Mar 12, 2010
I have a TabActivity. Each tab points to a sub activity. Works great.
Is there any clever way to refresh one of the activity tabs? I just want to 'restart' the activity in tab #3 for example. Not sure of a good way to do this other than building in refresh support to the activity itself, or clearing ALL the tabs and recreating all of them.
View 1 Replies
View Related
Jul 21, 2010
I want to add tabs to the layout of my activity, but I don't want the activity to extend TabActivity. The example in http://developer.android.com/resources/tutorials/views/hello-tabwidget.html only gave example of subclass of TabActivity.
Is there any way I can make it without extending TabActivity?
View 1 Replies
View Related
Apr 3, 2010
I'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 Related
Jul 9, 2010
Is there a way to get an instance of the activity that has called the currently running activity from the intent object that has been passed to it? eg. if A has called B, I would like to retrieve A's instance from the intent in B's onCreate method. As Activity is not Serializable i am not able to pass the instance in the extras bundle.
View 1 Replies
View Related
May 9, 2010
I have a bunch of tab activities (which I implemented myself, didn't want to use the tabviews with activities inside them), so It's basically 5 activities calling each other every time the user clicks on the tabs displayed as a row of LinearLayouts at the bottom of the screen.
The thing is that the way I do it now, everytime the user jumps from one activity to another, a new activity is created and launched. Of course, I can see I'm wasting resources this way. So what I would like to do is to create every activity only once; and then if the user wants to go back to the previous (or any one that was already created and is probably paused) just check on some kind of list or array to see if the activity can be recovered and only in the case it can't; to lauch a new one.
My question is, how can I check this? should I save the intents? and how to recover the activities afterwards? I'm kind of new with java.
View 2 Replies
View Related
Jul 19, 2010
Is there any way to get the instance of a launched activity(or any view in that activity )of a application in another application.
View 1 Replies
View Related
Aug 16, 2010
We all know that hitting the back button on the device doesn't kill the application, it merely finishes (destroys) the activity running on the foreground.
Well I have come across some code which helps me capture the back button signal so that I cannot exit the application. The only way to exit it in such cases is to press the home key.
Now this situation presents me with a unique disadvantage! The inability to kill finish the application on a time of my own choosing allows the application to keep running in the background like nothing has changed.
So in such cases is the task manager my only friend or is there a way for me to otherwise kill this application?
View 2 Replies
View Related
Dec 4, 2009
I'm trying to create a tabbed view in my widget configure activity. I'm using a tab activity as my activity type and I have the following code..................
View 2 Replies
View Related
Sep 2, 2010
Is it possible to create/push-onto-stack a new Activity of the same main Activity in an Android application with an argument passed to the Activities constructor? Specifically from a Dialog object...
View 1 Replies
View Related
May 21, 2010
My app consists of an Activity and a service that runs in the background. The service periodically checks a website for an alarm condition. When the service detects the alarm, it should put a user notification into the status bar. If the user clicks the notification, it should display the app's activity. If the activity is already running, that activity should become visible. If the activity is not currently running, it should be created.
However the notification created by my service *always* creates a new instance of the activity, whether the activity is currently running or not. How do I get the desirable behavior?
Here is my service pseudo-code:
CODE:...............
View 3 Replies
View Related
Nov 11, 2010
I want to show my next activity withing my previous activity layout "LinearLyout". But it is not working. Can any one help? I put my last activity layout reference to a global class in an static variable. My code...
View 3 Replies
View Related
Aug 27, 2010
My 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 Related
Apr 27, 2010
How 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 Related
Nov 5, 2010
The 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 Related
Jul 16, 2010
I 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 Related
May 28, 2009
I'm working to finish a small application, but I'm having problems seeing what combination of activity attributes and intent flags I need to achieve my intended application design. Trying my best not to describe the app in minute detail, here's the basic operation (I've supplied screenshots in the hope it makes sense easily): Users have a garden which contains flowers (GardenActivity).
http://www.tomgibara.com/images/daisy/garden/hut_screen.jpg
They can tap on a garden to see details of flowers (FlowerActivity)
http://www.tomgibara.com/images/daisy/garden/flower_screen.jpg
When flowers are fully grown a notification provided, tapping on the notification displays the garden containing the flower.
http://www.tomgibara.com/images/daisy/garden/notify_screen.jpg
Users can also use the GardenActivity as a picker to choose flowers to "exhibit" (ConfigureActivity)
http://www.tomgibara.com/images/daisy/garden/planting_screen.jpg
I want the app to operate so that if the user already has a GardenActivity somewhere in the stack (whether it's at the top, or underneath a FlowerActivity) the notification will alert the user by bringing that activity to the front (clearing any FlowerActivity that may be above it). I've tried using the FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP combination (without changing any activity launch modes) on the notification's pending intent, but it still launches a new GardenActivity, even if one is already available.
I've also tried using android:launchMode="singleTask" on GardenActivity. The notifications then seem to work correctly, but it prevents GardenActivity from returning any result back to ConfigureActivity.
View 3 Replies
View Related
Oct 31, 2010
I'm writing a bitmap editor and I'm trying to write an autosave feature. When onPause is called, I write the application state to an autosave file. As this takes between 0.1s and 1.5s, I've been advised this IO operation be performed in a background thread.
In the onCreate method of my activity, I check to see if the autosave file exists and, if it does, I open it.
Are there any scenarios I have to consider where the user can somehow leave the activity, the autosave thread starts and the user can return to the activity before the thread has finished? If so, how can I detect this and wait for the thread to finish before I check the state of the autosave file?
I was going to make it that, when the user backs out of my activity, they're asked to wait a second while the data is saved. This seems OK, but I can't do this when my activity is interrupted by something like a phone call.
Also, I'm a bit confused about how multiple versions of the same activity can be started as this makes dealing with autosaving more complex. Is there a way to make sure only one instance of my activity is allowed to run at a time?
View 2 Replies
View Related
Jun 24, 2010
Application (non-wanted) behavior - application is started, some text is put into text-box and notification is created through button action. user "clicks" the home button, application is "minimized", notification is available in bar user selects the notification and the application is "maximized"
BUT - instead of the original instance, new instance is started (e.g. in the newest instance is missing the original text; when the latest instance is closed there is still the original instance with original text ) .
The code of the notification method
CODE:.....
I have also in the manifest xml file following tag android:launchMode="singleTask"
But it is still the same...The main problem is double/triple initialization of the application, i know that there are other means to preserve the values in resumed applications. Also it is needed that the applications stays running in background as the main functionality is the streaming of internet radio.
What is missing in the code ? What kind of information from my side is missing for to troubleshoot the issue ?
View 3 Replies
View Related
Apr 27, 2010
I've got an android app that pulls a random 20 questions (rows) as a cursor from a SQLite DB and loops through all the questions to ask the user all 20 questions.
Is there some way to save the cursor's state/location when the activity is paused or stopped so that when the activity resumes the cursor is restored and in the same position as it was when the activity was paused/stopped?
View 1 Replies
View Related
Oct 4, 2009
Before asking my doubt, let me clarify my understanding of allowTaskReparenting...
Suppose there exists a Task (say Task 1) and this task has an activity (say Activity 1) which wants to call my Activity (say Activity 2). Let my activity (activity 2) set the attribute allowTaskReparenting to true and let my activity have a specific taskAffinity(affinity1). When Activity1 calls my activity (activity2), my activity becomes part of the task1. But suppose another task (task2) is already present/created with the same taskAffinity as mine (affinity1) and an activity in that task (say activity3) tries to start my activity, my activity gets re- parented to task2.
Not sure if i was clear enough. If i were to rephrase my words...
If my activity has allowTaskReparenting set to true and an instance of my activity is already present in task1. If task2 with the same task affinity as my activity tries to start my activity, the EXISTING activity gets re-parented from task1 to task2.
My quesions:
(1) Is my understanding correct ?
(2) If I am correct then a single instance of my activity gets shifted from task1 to task2. So 2 activity objects of my activity are NOT created.
View 5 Replies
View Related
Feb 6, 2010
I'm using an intent-filter on URLs for my activity:
CODE:...............
the launchMode attribute is set to "singleTop", but it looks like a new activity is created every time I click a matching url. I thought that if the activity is already alive somewhere, it would simply be brought to the front of my activity stack?
I tried this on the emulator/device, same behavior, a new activity instance is always created.
View 2 Replies
View Related