Android :: Android - Orientation Change - Exits Application But Without Crashing
Sep 2, 2010
I have two layouts: layout-port and layout-land. If I run the app with emulator or device, either vertically or horizontally, the app runs fine with the correct layouts. However, if I rotate either the emulator or device, the app exits. There's no crashing, perse', it just exits. I have other app's with similarly defined layouts that work fine without any orientation handling in the manifest. I'm not concerned about persisting data.
The main differences between the one's that work and this one are (this one has):
* Menus with sub-menus
* Dialog screens (not the android dialog widget)
* Tab widget
All of the above items work in their respective layouts (port and land), the app just exits when rotating the emulator or device and I need to restart the app.
View 2 Replies
Aug 31, 2010
I have set of images fetched from internet and set it on gridview,here i have option to click here to view more,below the grid view and it fetches images and set it on grid with prevoius set of images,when i exit the application and run it again,the previous set of images remain in cache and grid shows images from cache,here i need to clear my application cache memory,when i exited my application.how can i get it.
View 1 Replies
View Related
Nov 2, 2010
When I change orientation application restarts and I lost my current data.. I am using activity group which contain lots of activities when i change orientation application restarts from main activity. is it possible to avoid this application restart on orientation change?
View 4 Replies
View Related
Sep 11, 2009
is there a way to make application to completely ignore screen orientation change?
View 4 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
May 5, 2010
So I am making a basic chess app to play around with some various elements of android programming and so far I am learning a lot, but this time I am lost. When the orientation of the emulator changes the activity gets reset. Based on my research the same thing will happen anytime the application is paused/interrupted, ie. keyboard change, phone call, hitting the home key etc. Obviously, it is not viable to have a chess game constantly reset, so once again I find myself needing to learn how to fix this problem.
My research brings up a few main things, overriding the onPaused method in my Activity, listening for Orientation, Keyboard changes in my manifest (via android:configChanges), using Parcelables, or Serialization. I have looked up a lot of sample code using Pacelables, but to be honest it is too confusing. Maybe coming back tomorrow with fresh eyes will be beneficial, but right now the more I look at Parcelables the less sense it makes.
My application utilizes a Board object, which has 64 Cell Objects(in an 8x8 2D array), and each cell has a Piece Object, either an actual piece or null if the space is empty. Assuming that I use either Parcelable or Serialization I am assuming that I would have to Parcelize or Serialize each class, Board, Cell, and Piece. First and foremost, is Parcelable or Serialization even the right thing to be looking at for this problem? If so is either Parcelable or Serializable preferred for this? And am I correct in assuming that each of the three objects would have to be Parceled/Serialized? Finally, does anybody have a link to a simple to understand Parcelable tutorial? Anything to help me understand, and stop further headaches down the road when my application expands even further.
View 6 Replies
View Related
Nov 2, 2010
When I change orientation application restarts and I lost my current data.. I am using activity group which contain lots of activities when i change orientation application restarts from main activity. is it possible to avoid this application restart on orientation change?
View 3 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
Oct 1, 2012
I have an android app I am working on in Eclipse. It has 1 activity with some fragments in it which works fine. But when I go into any of my fragments, which either consist of a layout statically made or dynamically made, I then hit the menu button and go to the "Display" section of my phone to change the font of my android device Ex) Normal to Large or Large to Normal. Once I do that I open my app again thinking that the text in my app should grow/shrink and still be on the same fragment like I have seen in other apps but instead it just crashes.
I have a feeling it has to do something with the fragment or my activity's lifecycle methods but I honestly do not even know where to begin. I understand how the lifecycles flow but as for putting code into these methods to fix this issue I do not even know where to begin. The only methods so far I have used/Override with my code in it is the "onCreate()" in my Activity, onActivityCreated() in my ListFragment and "onCreateView()" in my fragments.
This code snippet here is when I go from Activity (MainActivity) -> ListFragment (JungleListFragment) -> Fragment (JungleInfo)
Code:
10-01 05:10:25.734: I/MainActivity(712): onCreate
10-01 05:10:26.564: I/MainActivity(712): onStart
10-01 05:10:26.564: I/MainActivity(712): onResume
[code]...
View 1 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
Mar 22, 2010
I have an application which fetches data from server and shows it in different lists in my application. I used the adb shell procrank command to find out the memory usage of my application It takes 10 mb for the UI (I have a single Activity ,but many layout files), And the data which comes from the server is stored in memory arrays for logical representation on UI (As well as database)and it takes 6 mb of the memory .So application's runtime size reaches to 16 mb and then many a times its crashing after that with OutOfMemoryException. Another major problem is that later for the next client release , the data comming from the server will be around 12 mb.. :( :( So i need to do a major restructuring in the App.I beleive that i cannot increase my App size from 16 mb to more So my question here is , can i have two seperate applications , one of which will fetch the data from the server and keep it in memory as well as database and another App will be used for showing the UI and it will do an inter Application communication to fetch the data and display it on the UI in this App. So the 1st App wil be a backgrond App which will handle Server communication as well as data storage , the second App will start this 1st App .
View 18 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
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
Mar 17, 2009
consider the simple layout:
CODE:..................
View 9 Replies
View Related
Dec 29, 2009
I am developing a photo frame widget, all works except on an orientation change to landscape mode my appwidget doesn't display correctly as I have it set to portrait dimensions and it is too large for the display. I would like to run some code to resize the image so that everything displays correctly and it uses all the space that I allot. What is the correct way to do this? I can think of 2 methods however both seem inefficient. The first would be to register a broadcast reciever to take orientation changes, however I don't want to redo my appwidget everytime the phone is turned on its side as the majority of the time the homescreen is not showing when the orientation is changed (ie other apps are used, and I don't need my code running in the background). I only need it to run when the home screen is shown. The second would be to setup a service to manage my appwidget but that also seems inefficient to be always running in the background.
View 10 Replies
View Related
Apr 24, 2009
Is it possible to have a user choose how an app should respond to orientation changes? I have it set to android:screenOrientation="sensor" in the manifest but I would like users to be able to turn this on and off or set landscape or portrait orientation permanently.
View 5 Replies
View Related
May 31, 2009
Some of the content in my widget is based on custom drawing routines. is there any event i can listen for so i redraw and update this custom area when the orientation changes? currently my widget looks pretty screwed until the next widget update is requested.
View 3 Replies
View Related
Apr 15, 2010
Well, preventing an orientation change is easy. But what about doing it at run time.
Say, I have an activity which supports orientation change in normal situations. It has say three Edit Texts.
There's also a button, which when clicked would do some processing in a thread while showing a ProgressDialog which is not cancellable.
Ok, so till the user hits the Button, I want the activity to be able to adapt the orientation changes. I have two layouts files for each orientation with different layout schemes.
What I want is this. Once the user clicks on the button, and the ProgressDialog is showing, I don't want the activity now to be re- created again when the orientation changes. So, before showing the ProgressDialog, is there any way to tell the Activity not to handle Orientation change?
Also, once the process is complete, and the ProgressDialog is removed, I want the Activity again to be able to handle orientation changes.
View 6 Replies
View Related
Aug 30, 2009
In the following sequence of events:
1. Start a new thread (as a result of a button click - or similar).
2. User changes the screen orientation (causing the Activity that started the thread to be destroyed).
3. Thread finishes, and wants to do some dialog (or any UI) work. However, doing a showDialog, dismissDialog, ... will crash, as the thread it still referring to the old Activity.
This can be solved by updating the data in the thread to refer to the new Activity upon a screen orientation change.
However, couldn't the Android framework just forward any requests from a destroyed activity, to the newly created Activity, saving us developers of handling it ourselves?
View 24 Replies
View Related
Feb 1, 2010
I have EditText in my application. While entering the text i am changing the portrait mode to landscape mode. Not the entered text is resetting. how do i handle this? Like if i change the orientation what ever entered text should be remain as it is.
View 2 Replies
View Related
Jun 17, 2009
Is the view aware of the orientation change in order to return updated size after a change in orientation? I'm handling the orientation myself (android:configChanges="orientation|keyboardHidden"). Does it means that I have to take into account the orientation state when querying for view.getHeight()? The view returns the same value as before the orientation change. It this the normal behavior or I should "notify" somehow the view to "refresh" its size.
View 2 Replies
View Related