Android :: Maintain Scrolling State While Orientation Change In Android
Oct 5, 2010
I have created one custom view that contains the horizontalscrollview. Now when i changes the orientation its scroll state change to 0 every time. I got the previous scroll state by using onSaveInstanceState(Bundle savedInstanceState) and onRestoreInstanceState(Bundle savedInstanceState) . in onRestoreInstanceState i am using following method to get reposition the scroll, hoz_scroll.scrollTo(hoz_x_pos, hoz_scroll.getScrollY());
View 2 Replies
Oct 12, 2010
I was looking at the way Android handles orientation change for my application (I discovered that it restarts the mainactivity on orientation change :| ). I've seen that you can ovveride the method protected void onSaveInstanceState(Bundle outState)to save stuff, then have the in onStart. The problem is that I've my view with custom objects and a listview using a custom adapter... Everything is in a ArrayList of these objects, but I've noticed that you can't put arbitrary objects in the bundle! So how do I save the state?
View 2 Replies
View Related
May 6, 2010
I m currently working on landscape mode for android app in which i want to know how to maintain the state of the activity and views displayed on orientation change i.e from portrait mode to landscape mode ?
View 3 Replies
View Related
Oct 20, 2009
I have a custom View, what is the proper way of saving / restoring it's state after orientation change. I know I should implement onSaveStateInstatnce() and onRestoreInstanceState() methods, but how exactly (with which argumets) and when I should call them?
View 4 Replies
View Related
Oct 6, 2010
My ListActivity is bound to an ArrayAdapter where I have overriden the getView() method. If I change the visibility of a widget in that method or modify the view's background color, those changes somehow get lost once that modified list item returns after being scrolled off the screen. In fact, some other view in the list is picking up the changes. How do I get the modified view to look the same when it's redisplayed after scrolling?
View 1 Replies
View Related
Nov 9, 2010
This usually happens when the user hits "Home", does something else, then eventually wanders back into the app - it attempts to go back to where it was before, but the application Context has mysteriously lost all its previously-saved state information (in my case, a few integers and a few Strings). I know this is a very vague question, but are there any cases (other than the user using "back" to back completely out of the application) where the application Context gets completely destroyed even though the application is not terminated? Is there a better way to maintain persistent state information?
View 1 Replies
View Related
Apr 8, 2010
I am working on my App. in between i pressed the Home button on the device. my app will go to the background tasks. After that i long press the home button it will show my app as a persistent state. i.e where and what i had done in my app. But i click my app in the directory window it restarts my app. i want to do if my app is in the background tasks it will wake up else it will start. how to achieve that?
View 1 Replies
View Related
May 13, 2010
I am having an application showing ListItems and Dialog boxes in it.. I want that when i change the orientation from Portrait to landscape mode, i need to maintain the state of the application .. I have seperate XMLs for landscape and portrait mode..
View 11 Replies
View Related
May 14, 2009
I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.
Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).
After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?
View 3 Replies
View Related
Oct 7, 2010
I'm facing problem in scrolling. I've 20-25 items in my List, if i checked first check box, scroll down, then come up, my checked status lost (becomes unchecked), in cursor adaptor. If i use base adaptor problem is resolved but major issue with base adaptor is performance, if my list goes beyond the 100 items.
View 9 Replies
View Related
Aug 22, 2010
I've successfully implemented onRetainNonConfigurationInstance() for my main activity to save and restore certain critical components across screen orientation changes.
But it seems, my custom views are being re-created from scratch when the orientation changes. This makes sense, although in my case it's inconvenient because the custom view in question is an X/Y plot and the plotted points are stored in the custom view.
Is there a crafty way to implement something similar to onRetainNonConfigurationInstance() for a custom view, or do I need to just implement methods in the custom view which allow me to get and set its "state"?
View 1 Replies
View Related
Jul 30, 2009
I have a notification that starts my activity and passes a messages using the intent's putExtra() function. The message is then displayed to the user in the activity's onCreate function. When the application is restarted due to a orientation change, the message is shown again as it is still in the intent's bundled data.
How can I remove the extra data?
I tried the following:
Bundle bundle = getIntent().getExtras();
if (bundle.getBoolean("showMessage")) {
// ... show message that is in bundle.getString("message")
// remove message
bundle.remove("showMessage");
}
But the message will still be shown after the orientation changed, seems like the intent used is not the one I changed, but the original one. The only workaround I found is to save the showMessage additionally in onSaveInstanceState(). Is there another way? Or is this the way to go?
View 2 Replies
View Related
Jul 22, 2010
I have a widget which has say, a dimension of 294*72(portrait). But when the orientation is changed, I need to change this dimension of the widget to another dimension which would look good on the landscape orientation.
View 4 Replies
View Related
Jun 8, 2010
I have an image set as my background and when it is vertical, the image looks fine. However, when the orentation is changed, the image get streched out. If there a way that I can change the image based on the orentation of the device?
View 4 Replies
View Related
Jul 11, 2009
Am I right if I say that, there is no broadcast action currently for the SIM card state changes?
View 2 Replies
View Related
Feb 5, 2010
I am able to display multiple overlayItems on Googlemap, now I want to change icon of any specific overlayItem (to show it is currently selected event). I want to do it through navigation buttons (next, previous) as on Google maps.
I am using StateListDrawable to display icons for OverlayItems. code...
Now my question is how do I change the state of any overlayItem/Icon on map when user click on one of navigation keys?
View 1 Replies
View Related
Feb 19, 2009
I wanna write an app to enable and disable the Bluetooth device synchronized. Referring the Android source code, I registered following receiver to receive the bluetooth state change event:
CODE:............
But it doesn't work. Although the BT status has been changed (the icon of BT has been appeared or disappeared), the receiver could not receive nothing.
View 5 Replies
View Related
Aug 1, 2010
I am using the Android SDK icon-button for refresh (ic_menu_refresh) in a widget and I need to change the selection state when it is pressed. How is this done? Do I define an XML for the button?
View 1 Replies
View Related
Mar 25, 2009
I am building a AlertDialog in java code, so by default it is portrait but I want to show it in landscape orientation. How to do it in Java code?
View 2 Replies
View Related
Oct 8, 2009
I notice when using the emulator that when the screen is flipped, I get a following logcat message:
INFO/WindowManager(589): onOrientationChanged, rotation changed to 1
How can I catch this in the code? I want to know whenever the orientation changes. I assume I have to set a listener, but I can't find an example anywhere.
View 6 Replies
View Related
Mar 5, 2010
I'm doing an APP that shows some dialogs. Those dialogs are Alert dialogs, and when they are being showed if I change the orientation of the mobile I lost them...they are not being kept on the screen.
View 13 Replies
View Related
Oct 1, 2009
Do Views know changes in orientation? In my case, I create popups from TextView and need to know when the orientation changes(porttrait<-- >landscape). I cannot depend on activity's onOrientationChange.
View 2 Replies
View Related
Feb 11, 2009
I am making an Android app which is currently coming along nicely - I've hit upon a couple of stumbling blocks.
1) How do I stop the screen from going dim/off and the phone locking while the application is running?
2) Can I force the phone to enter landscape mode on running my application?
View 2 Replies
View Related
Jul 1, 2009
My app *sometimes* when orientation change, leaks Activities (getInstanceCount() increases from time to time) and i cannot figure out where references to my Activity or rather Context are kept - tried to use jhat but it couldn't help me much.
what is strange: it doesn't always happen on orientation change, so its even harder to fix.
btw when doing normal app life cycle - start, do something, exit - everything is ok - getInstanceCount() always returns 1.
View 5 Replies
View Related
Apr 28, 2010
I have an activity that checks stuffs online when it's created (is the GPS on and if not it asks if the user wants to turn it on).
The problem I'm having is that it is also doing it everytime I change the orientation of the screen.
I've read some comments on onConfigurationChanged() but is there a better way to be sure I'm checking the GPS only when the activity is first created?
View 4 Replies
View Related
Feb 17, 2010
I want to send an intent to my service everytime the state of Wifi connectivity changes. So when I currently use a broadcast receiver to listen for the state changes in Wifi, so when this recieves an intent I want to be able to send this info on to my service. Is this possible and if so the correct way to do it?
View 2 Replies
View Related
Apr 9, 2009
I have a main activity class that launches a couple of my subordinate activities from a tabHost.
Periodically (actually when I receive an incoming message on a socket), I want to inform the subordinate activities that application state has changed so that they can refresh their views.
In Swing I could wire this together using something like a PropertyChangeListener. As far as I can see, the Android design philosophy requires creating an Intent and broadcasting to (as far as I can tell all) other activities that are running.
This strikes me as overkill considering that I'm only trying to notify my own views of a model change. Am I missing something?
View 2 Replies
View Related
Jun 23, 2010
built a simple app that displays an alertDialog with two buttons.The problem is it's not getting dismissed when i change orientation. After change i get a leak warning on debugger and the dialog appears twice(pressing back hides the first dialog, only a second back dismisses it completely).
View 7 Replies
View Related
Nov 6, 2010
I want to know how to change the orientation of my layout inside of eclipse but when I click the "layout" button it still shows it as a vertical layout.
View 4 Replies
View Related
Nov 6, 2010
I want to know how to change the orientation of my layout inside of eclipse.
View 1 Replies
View Related