Android :: Change Android Home Screen Orientation By Program
Nov 25, 2009
I got a question about screen orientation in Android Home screen. The scenario is as following. A G-sensor detects the movement on the device. Then it rotates the screen. If the device is portrait mode, the system sets to landscape mode. With G-sensor, theres is a SensorService to detect that and do some things to reach the function. I want to know how to reach that? Is there a API or a event to do that? I means that hall system, not a activity!
View 4 Replies
Mar 15, 2010
I am writing a home screen widget and want to update (modify) the home screen widget when the device orientation changes from portrait to landscape or the other way. How can I make it? Currently, I tried to register to CONFIGURATION_CHANGED action like the code below ...
View 3 Replies
View Related
Nov 11, 2009
Is there a way to make the home screen change orientation with the accelerometer? On my phone, it will only change when I pull out the physical keyboard, which is not really what I'm looking to do most of the time.It changes just fine in all other applications, but the home screen doesn't. Is this a flaw with my phone or a design decision?
View 6 Replies
View Related
Nov 18, 2010
I snap a photo, and it gets placed onto an ImageView. When the user sees the page where the Image View is, and I turn the phone sideways where the orientation is horizontal, the app immediately returns to the app's main screen.
View 1 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
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
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
Apr 23, 2010
Specifically, I need a way of _not_ performing the onPause functionality I've implemented when it occurs because of a change in screen orientation.
View 9 Replies
View Related
Jan 21, 2009
From reading Romain Guy's blog post, I understand keep static reference to a Drawable can create huge memory leaks. So what is the recommended solution if I don't want to reload my big Drawable image every time screen orientation changes and effect on performance? Currently my app takes >3 seconds to complete each orientation change.
View 8 Replies
View Related
Nov 1, 2010
I want to change the screen orientation from portrait to Landscape and vice-versa when the user shakes his/her android mobile phone, can any one help how to achieve this, because I do not know what event is fired, at the time his/her shaking thier android mobile phone. For Instance When the users touch the button in UI, touch event is fired, similarly when the user shakes his android mobile phone, what is fired.
View 3 Replies
View Related
Jan 14, 2010
I think after install my application, then my app does not appear in the home screen or luncher?But I can start my app by other appliction. Can any one help me?
View 3 Replies
View Related
Jan 24, 2010
I have a 3 nested ViewFlippers which seem to be working ok except that when I change the screen orientation the view flip back to the first one of my views, giving the user the impression it went back a few steps.I am a bit stumped as to what to do and was hoping someone had some experience with this.
View 3 Replies
View Related
Mar 12, 2010
I'm trying to find a way to properly handle setting up an activity where its orientation is determined from data in the intent that launched it. This is for a game where the user can choose levels, some of which are int portrait orientation and some are landscape orientation. The problem I'm facing is that setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) doesn't take effect until the activity is fully loaded. This is a problem for me because I do some loading and image processing during startup, which I'd like to only have to do once.
Currently, if the user chose a landscape level:
the activity starts onCreate(), defaulting to portrait discovers from analysing its launching Intent that it should be in landscape orientation continues regardless all the way to onResume(), loading information and performing other setup tasks at this point setRequestedOrientation kicks in so the application runs through onPause() to onDestroy() it then again starts up from onCreate() and runs to onResume() repeating the setup from earlier
Is there a way to avoid that and have it not perform the loading twice? For example, ideally, the activity would know before even onCreate was called whether it should be landscape or portrait depending on some property of the launching intent, but unless I've missed something that isn't possible. I've managed to hack together a way to avoid repeating the loading by checking a boolean before the time-consuming loading steps, but that doesn't seem like the right way of doing it. I imagine I could override onSaveInstanceState, but that would require a lot of additional coding. Is there a simple way to do this?
Solution:
As per Daniel's answer, this was actually quite easy to fix. I just needed to make a few small changes. In my 'menu' Activity, where the player would choose which level to play, I just had to add an if/else check to choose which class would be started by my Intent. This was done with a simple int representing portrait or landscape, determined when the player selected a level. I then created a second class extending my 'GameLogic' class; this is the class which contained most of the code for the game itself, rather than the menus, instructions, etc.
public class GameLandscape extends GameLogic{}
Literally that simple and completely empty. That way it inherited all the code from my previous activity where I had already coded it to handle things differently depending on the orientation. Lastly I just had to add a line to the manifest stating that GameLandscape would always run in landscape, and GameLogic would always run in portrait.
View 2 Replies
View Related
Mar 20, 2010
I am relatively new to the Android world and am having some difficultly understanding how the whole screen orientation cycle works. I understand that when the orientation changes from portrait to landscape or vice versa the activity is destroyed and then re-created. Thus all the code in the onCreate function will run again. So here's my situation: I have an app that I am working on where it logs into a website, retrieves data, and displays it to the user. While this is all done in background threads, the code that starts these threads is in the onCreate function. Now, the problem lies in that whenever the user changes the screen orientation, the app will log in, retrieve the data, and display it to the user again. What I would like to do is set a boolean that tells the app if it is logged in or not so it knows whether or not it must log in when the onCreate function is called. So long as the app is in memory the HttpClient will exist and contain the cookies from logging the user in but when the app is killed by the system those will go away. So I would assume that I need to do something like setting the logged in boolean to false when the app is killed but since onDestroy is called when the screen is rotated how is this possible? I also looked into the finalize function and isFinishing() but those seem to not be working.
Shorter version: How can I distinguish between when an app is being killed from memory from when an activity is being rotated and different code for each event?
View 2 Replies
View Related
Jan 2, 2010
How do we change emulator screen orientation to landscape or portrait?
View 2 Replies
View Related
Nov 4, 2010
I am developing droid apps with eclipse (new to both) and have a basic Layout question. When using the layout tab (rather than the coding tab) in my main.xml, I am trying to create a home screen for when my app opens.
There is going to be the logo at the top center, then 3 simple buttons below, all centered. How do I go about formatting the Logo so it maintains a size relative to the person's screen size, and stays in the center?
I don't want to write sloppy code to where my program looks fine (UI wise) on my screen and is poorly formatted on other's screens. Also, is there good documentation explaining all of the Property values in the layout view?
View 1 Replies
View Related
Sep 11, 2009
is there a way to make application to completely ignore screen orientation change?
View 4 Replies
View Related
Aug 13, 2010
It seems when screen orientation changes, the activity's onCreate() method is called. In my onCreate() method, I have an AlertDialog which pops up when the activity is called. The problem is when I switch the screen sideways, the popup is displayed again. How can I avoid this?
View 1 Replies
View Related
Oct 1, 2010
To anyone who has the SF do your home screens switch from portrait to landscape automatically when you hold the phone sideways? Mine does in just about all other screens but not the home.
View 5 Replies
View Related
Jun 15, 2009
I found if change screen orientation continouously when a call is ongoing, that is, portrait -> landscape -> portrait- >landscape.
View 3 Replies
View Related
Nov 24, 2010
In onCreate method of Activity, it binds to a remote service and makes use of AIDL intefaces. Is it required to unbind from the remote service when onDestroy is called on screen orientation change.?
If the activity un-bounded from the remote service in onDestroy and if no other contexts are bound to remote service, is remote service likely to get stopped losing the state that it maintains.?
View 1 Replies
View Related
May 12, 2009
I'm the proud owner of the HTC Magic on Vodafone UK. I'm loving the Android.I have to say that after 5 days of owning this device I'm only left scratching my head on one point the auto-orientation of the home screen.I've seen videos of rooted G1's running the hacked 1.5 firmware and the recently posted video of the Samsung i7500 with the 1.5 firmware all CLEARLY show that when the device is on home screen, the desktop (read home screen) auto-rotates depending on the orientation of the device. The Samsung video shows it working in ALL FOUR orientations!This doesn't happen on my Magic . Flip the orientation in an application? Works fine. Flip it back in an application? Works fine. Do it on the home screen?Am I missing something? Is this a feature that is disabled in the offical 1.5 Cupcake release? If that's the case - fine with me. I'll stop scratching my head and move on.
View 9 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
Jul 10, 2009
My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler.This all works fine, except when screen orientation changes while the dialog is up (and the background thread is going). At this point the app either crashes, or deadlocks, or gets into a weird stage where the app does not work at all until all the threads have been killed.How can I handle the screen orientation change gracefully?
View 9 Replies
View Related
Aug 29, 2010
I'm testing an app on a Droid. It's a kind of card matching game. I'd like to keep the cards physically located in the same place on the screen regardless of a screen rotation. For example, I can put my thumb on a card, rotate the phone any way I please and the card stays fixed under my thumb. However, the orientation of the content of the card will change to match the current phone rotation. I handle this by transforming the card grid in onCreate. This works fine for 90 degree rotations, but if I do a fast 180 degree flip from one landscape mode to another the screen simply flips and the Activity is NOT destroyed and recreated.
This seems contrary to the documentation:
http://developer.android.com/reference/android/R.attr.html#configChanges
"public static final int configChanges Since: API Level 1
Specify one or more configuration changes that the activity will handle itself. If not specified, the activity will be restarted if any of these configuration changes happen in the system. Otherwise, the activity will remain running and its Activity.onConfigurationChanged method called with the new configuration. "
I am NOT specifying any configChanges in my AndroidManifest.xml file, so it seems that the activity SHOULD be destroyed and recreated. Why isn't it? Is there some way I specify that it should be destroy/ recreated?
View 7 Replies
View Related
Feb 19, 2010
I searched for this but couldn't find a solution. Is there anyway to get the home screen and subsequent side screens to go into landscape mode? I've seen some other Android Phones/Tablets doing this and would like to be able to do so. Or does anyone know if this will be an option in the 2.1 update? I heard that the Droid used to do this, and then some update messed it up, but then saw it going into landscape mode on the video they posted today of the Droid running 2.1.
View 5 Replies
View Related
Jun 10, 2010
I am overriding the onCreateDialog and onPrepareDialog methods or the Dialog class. I have followed the example from Reto Meier's Professional Android Application Development book, Chapter 5 to pull some XML data and then use a dialog to display the info. I have basically followed it exactly but changed the variables to suit my own XML schema as follows:.................
View 3 Replies
View Related
Nov 12, 2010
I'm new to Android development. I'm trying to use the orientation change to switch between two activities. My idea is to use three Activities one TabActivity and a normal Activity. Here is some pseudo code:
public class Main extends Activity{
// this is the entry point into my app
@Override
public void onCreate(...){
if(this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
// Start Activity1
} else { //Start Activity2}..............
I'm taking a different approach. As i need a TabActivity, because i want to be able to start different activities in my tabs (I think i have to use a TabActivity in this case). I've edited the Manifest.xml and added android.configChanges="orientation" for the TabActivity and the second Activity. Then I've overridden the onConfigurationChanged() functions. With this approach I'm able to switch from landscape (this is the "normal" activity") to portrait (the TabActivity). The other way round does not work and i don't know why yet. I've exactly the same onConfigurationChanged functions (Copy & Pasted) and only changed the essential parts. Overriding the onConfigurationChanged of the Activities started in the tabs has no effect, too.
View 1 Replies
View Related
Dec 8, 2009
I tried Home++ yesterday and didn't like it too much although I may just have to try it again. I didn't care for that "power strip" in Home++ either (can you turn it off?). I wished it would import all the icons from my regular home screen into Home++ so I don't have to re-create everything. Does anyone else out there have a better home screen replacement program? I saw people talking about GDE but I couldn't find the actual application in the Market Place. I also looked at the Panda Home but from the screen shots, it looked weird. I like the plain-jane version that came with my phone. I don't want fancy skins or colors or bells and whistles.
View 11 Replies
View Related
May 26, 2009
I'm making App Widget program on Android 1.5 I wonder if I can change my app widget size on home screen . I can set my app widget's size in XML file. But, how can I change it's size after my app widget launched from home screen ? I want to add some button to my app widget that can change it's own app widget size. Is this possible?
View 3 Replies
View Related