Android :: OnSaveInstanceState Function In Main Activity Of TabHost-based Application
Aug 30, 2009
I've implemented an onSaveInstanceState function in the main activity of my TabHost-based application. I need to save the state of various objects I am keeping in memory that I have all marked as serializable, as well as some basic int and string values. I have stepped through my application and watched it call the onSaveInstanceState function and presumably save everything without any manner of exception or problem. The issue is that my onCreate function is being called with a null Bundle value every time after I start the application again. I'm really at a loss and unsure why it would call the save but not pass anything into the create.
View 1 Replies
Nov 14, 2010
I am developing an android application where I have a main-activity that contains a progress bar and a tabhost. the tabhost has 3 tabs.How do I from a tab-activity access the progress bar in the main activity? I want to be able to start and stop the progress bar when things changes inside each tab ativity.
View 1 Replies
View Related
Oct 5, 2010
Is there a way to manage application activities by hand, like this: user activating an application from menu, it does some initialization, then creates some activity (is it necessar y to declare all activities in the application manifest?), and listens to it's events. On some event application decides to close one activity and open another - so it contains all the application logic. Didn't found anything like this in examples, they all have all the logic in the activity classes. Maybe I need to user Services? (Maybe I don't understand right, what an activity represents. For me it's like window in windows, or Displayable in j2me) I'm very new to android development, trying to understand the basics.
View 4 Replies
View Related
Oct 29, 2010
Can anybody tell me what method of an activity executes when an application closes?. Like I have a main activity and if I press back button on my phone. The Application closes so I want to know what method executes at that time.
View 1 Replies
View Related
Apr 21, 2009
I have made a game with just one activity.. I just replace the views when I want to change screen. The game runs fine for a really long time inspite of what ever I do within the game.
But once I close the main game, by calling finish on the only activity in the application, and then when I start again, within the next 30 secs it crashes telling VM budget exceeded..
When I don't have a dispose() or a delete method in JAVA.. how the, am I supposed to remove the objects used in memory.. moreover I have android:launchMode="singleInstance" in my manifest
View 4 Replies
View Related
Jan 13, 2010
I've searched and I know it seems some people frown upon using activities within tabs, but moving past that...how would I restart a tabbed activity while still keeping the tabs visible? I have an activity in a tab, I use the menu to create a new activity to update the tab's activity displayed info, when I return from the menu activity I want the new information to be displayed in the tab's activity. I am using startActivityForResult() from the menu choice, but when I return and try to restart the activity...it wipes out the tabs above(I guess as expected, but I want to re-launch the refreshed activity within the tab).
Creating the tabs:
TabHost host = getTabHost();
Intent home_intent = new Intent(constants.HOME_ACTION,
null, this, homeTab.class);
Intent inbox_intent = new Intent(constants.INBOX_ACTION,
null, this, inboxTab.class);
Intent stats_intent = new Intent(constants.STATS_ACTION, null,
this, infoTab.class);
host.addTab(host.newTabSpec(constants.HOME_TAG)
.setIndicator(getText(R.string.home_label),
getResources().getDrawable(R.drawable.icon))
.setContent(home_intent));
host.addTab(host.newTabSpec(constants.INBOX_TAG)
.setIndicator(getText(R.string.inbox_label),
getResources().getDrawable(R.drawable.icon))
.setContent(inbox_intent));
host.addTab(host.newTabSpec(constants.STATS_TAG)
.setIndicator(getText(R.string.stats_label),
getResources().getDrawable(R.drawable.icon)).setContent(
stats_intent));
Return from the menu activity in the tab's activity(updating database info): code...
View 2 Replies
View Related
Nov 17, 2010
I must be overlooking something because I am unable to get my TabHost to display in my Activity class.I am getting the dreaded force close when I try to run the app.It will work if I extend TabActivity, but I can't do that [details at the bottom] because once I move the code from my prototype project its going to be in a custom class that inherits from Activity.
View 2 Replies
View Related
Dec 8, 2009
I have created a TabHost and in 1 of the tab, I have added the content using
mTabHost.addTab(mTabHost.newTabSpec("tab1")
.setIndicator(getString(R.string.dialerIconLabel),
getResources().getDrawable(R.drawable.ic_tab_dialer))
.setContent(intent));
Is it possible for me to switch the content's activity programatically after I called 'addTab of TabHost'?
View 1 Replies
View Related
Jul 16, 2009
I know that the following code should show and hide a tiny circular progress bar with the following code in Android:
CODE:.............
The problem is that I am using a TabHost and I need to be able to do this from one of the "child" activities. Is there any way I can go about doing this?
View 2 Replies
View Related
Mar 23, 2010
I have 3 classes in my example:
Class A, the main activity. Class A calls a startActivityForResult:
Intent intent = new Intent(this, ClassB.class);
startActivityForResult(intent, "STRING");
Class B, this class is a TabActivity:
Intent intent = new Intent(this, ClassC.class);
tabHost.addTab...
Class C, this class is a regular Activity:
Intent intent = this.getIntent();
intent.putExtra("SOMETHING", "EXTRAS");
this.setResult(RESULT_OK, intent);
finish();
onActivityResult is called in Class A, but the resultCode is RESULT_CANCELED instead of RESULT_OK and the returned intent is null. How do I return something from the Activity inside a TabHost?
I realize that the problem is that my Class C is actually running inside of Class B, and Class B is what is returning the RESULT_CANCELED back to Class A. I just don't know a work around yet.
View 4 Replies
View Related
Jul 19, 2010
Im writing a program that offers a quick reply dialog upon receipt of an SMS.
However, I am getting an unexpected result. When I receieve an SMS, the appropriate dialog activity comes up displaying the correct phone number and message, however there is a second activity behind it that is the 'default' activity in my program (it is what opens when i launch my application)
I do not want this second activity to come up. The quick reply activity should come up by itself over top of whatever the user was doing before.
The 'floating' activity:
CODE:.........
The call to the activity inside an onReceive()
CODE:..............
The Manifest:
CODE:.................
View 1 Replies
View Related
May 16, 2010
I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?
View 2 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
Dec 4, 2009
Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.
View 3 Replies
View Related
Jan 10, 2010
I hav an app that is like a relational database. There is a main app activity that users manage things with. There is also a widget that will display important info and add data to the database. When the widget is clicked, a configure class displays a way for the user to edit data. When the configure activity is done, the widget is updated and instead of going back to the home screen, the apps main activity is started. I can't find where the main activity is being called from. Wouldn't I have to create an intent and start Activity() to get this behavior? When done updating, I want the home screen and not my app.
View 3 Replies
View Related
Nov 7, 2010
I have a main activity, then i call a new activity intent from this. Lets call this SecondActivity. Then from my secont activity i call a browser intent. Then my browser intent call my second activity's onNewIntent method.Evereything work fine, but when i click on "back" button on my phone on my second activity, i will not going to my main activity, but the browsers activity, why?
View 1 Replies
View Related
Nov 3, 2009
I've got a tab host activity started from a home screen shortcut. When my application starts it downloads information from a server using an AsyncTask. In the onPostExecute method of the AsyncTask I call setContentView to display the TabHost.When I start the homescreen shortcut by tapping on the shortcut using my finger everything works as expected, I download the information from the server and display the TabHost with the information in the tabs. However starting the application by navigating to the shortcut with the mouse wheel and then clicking on the shortcut with the mouse wheel leads to a trap in the framework code as soon as my application starts. This looks like a simple fix since mCurrentView is null at the time that this method is called - can this issue be addressed? Does anyone know of any workarounds?
View 5 Replies
View Related
May 28, 2010
I've been told that Android OS stores all function calls in a stack. This can lead to many problems and cause the 'hiccups' during runtime, even if a program is functionalized properly, correct?
So the question is, how can we prevent this from happening? The obvious solution is to functionalize less, along with other sensible acts such as refraining from excessively/needlessly creating objects, performing static calls to functions that don't access fields, etc...
Is there another way though? Or can this only be done through careful code writing on the programmers' part? Does the JVM/JIT automatically optimize the bytecode during compile time to account for this?
View 1 Replies
View Related
Jul 5, 2009
Am I right to assume that onSaveInstanceState() is not normally called (which my logging indicates) - but only when the system is forced to kill an Activity. If so, since onPause() does not receive a bundle, what is the best way to save state that should be restored the next time the Activity is created?
View 8 Replies
View Related
Sep 25, 2010
I have an application that has a tabActivity and 3 tabs. all off the tabs use a location listener and work with locations. i implement onPause and onResume for every tab to remove and start listening for location accordingly. is this the right way to go? i had another idea to work with and that was implementing a location listener to the tabActivity and doing broadcasts to the child tabs with the location, but it seemed more complicated.
The problem with my current solution is that whenever i switch tab i lose the location i got in the previous and i cant use getlastknown location because i dont want the last location on start of the application.(does this make sense?) what can i do to solve this problem. a thing that will work better will be to have one variable that will hold the last location from the onLocationChanged and i can observe its changes and call methods onChange.
View 1 Replies
View Related
Jan 27, 2010
I can build a daemon with my algorithm code and main function.I put all files in one folder under /development and make This executable file works successfully
Now I want to separate my algorithm code and main function code. I hope to build a binary library with my algorithm code and main function will link this binary library to use.
Where to put my algorithm code to create binary library and how to link this binary library in main function code?
View 2 Replies
View Related
Nov 30, 2009
From digging around a bit, getAssets() is an inherited method from ContextWrapper. It returns an AssetManager, and using open() it can return an InputStream. What I'm attempting to do at this point, is use the GLSurfuceViewActivity, Cube and CubeRenderer to work and learn off of and read in vertex data from a binary file. I've already created the binary output by parsing a model obj file and added to the assets directory. My Shape class (modified from the Cube class) does not have access to calling getAssets() since it's not a subclass of Activity or ContextWrapper. Once I accepted that, I tried to think of the best way to read in the data (without storing it extra places) to the Shape class. What I did, and seems to be working okay, was modify the Shape and ShapeRenderer constructors to accept an AssetManger as a parameter.
View 3 Replies
View Related
Apr 6, 2010
I am trying to make a app with the tuotrail of the developerspage, then I would like to display a main.xml in a tabview, instead the textview, wich in the tuotrail,is in the activity.How do I tell my tab in activity do display the main.xml?
View 1 Replies
View Related
May 11, 2010
I have Activity based tabs i.e i have used TabActivity,tabhost etc Now when we switch between the tabs, for the 1st time the oncreate is called and then after the onResume methode is called I want to know what event/function, of the activity, is called when i click on the the tab which is already selected. 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, visit this group at http://groups.google.com/group/android-developers?hl=en
View 2 Replies
View Related
Aug 24, 2010
I have a service which collect data and send them to a certain URL and updating the main activity GUI, so which is better in the performance to use a long service with listeners to collect the data and threads in it to update the GUI and sends to the internet or to make another service responsible for updating the GUI and sending to the URL only while the first one just collects the data?
View 5 Replies
View Related
Nov 11, 2010
so the application I've written has a service (that tracks GPS data) with a single main activity that binds to it with bindService in it's onStart() method, and unbinds from the service in it's onStop() method using unbindService( ServiceConnection ). I also have an activity which is an options screen, that is launched by pressing a button on the main activity. On this options screen, I have a checkbox that says "Run in background", which, if set to true, means that when the user exits the application with eier the Home or Back buttons, the service will continue running, not turning the GPS off. I do this by calling this.startForeground onUnbind, and this.stopForeground onRebind, if the setting is set to true, and stopping and starting my location reader onUnbind and onRebind respectively if the setting is false. If the service is running in the background, it also displays a notification to ensure the user understands that the GPS is still running and draining their power. This notification is displayed and stopped by relying on the startForeground and stopForeground methods......
View 1 Replies
View Related
Mar 30, 2010
I'm in a small problem.i have three activities (suppose A,B,C) after performing onclick event in activity A, i can go to activity B and then C..my question is that is there any way to comeback activity A from C..here is the code snippet public void on Create(Bundle Code...
View 3 Replies
View Related
Mar 29, 2010
My android application has 1 main activity. And it launches some sub-activity (which I wrote) and that also launches some sub-activity (which I wrote). I do this. My question is how can each of my sub-activity and sub-sub-activity get back to the Parent activity? Code...
View 2 Replies
View Related
May 20, 2010
My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. Code...
View 3 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