Screen flip doesn't trigger an orientation change and Activity destruction/recreation

by Rob » Mon, 30 Aug 2010 06:24:49 GMT

Sponsored Links
 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: #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?  Thanks.


Screen flip doesn't trigger an orientation change and Activity destruction/recreation

by TreKing » Tue, 31 Aug 2010 05:29:20 GMT


Just guessing, but landscape is landscape, regardless if it's 180 degrees,
so the system may not consider it to be a configuration change.

Sounds like a case where you should handle the orientation changes and / or
read the accelerometer values yourself.

TreKing <> ; - Chicago
transit tracking app for Android-powered devices


Sponsored Links

Other Threads

1. How do I programatically and permenantly remove an icon from the launcher

So, I was looking through the source code for launcher in git for the first
time after asking this question.  I got the UNINSTALL_SHORTCUT  to work via

Intent myIntent = *new* Intent(Intent.*ACTION_MAIN*);

//This sets the classname to UninstallTestApp which is the name of the app
this code is in
myIntent.setClassName(*this*, *this*.getClass().getName());

Intent intent = *new* Intent();

intent.putExtra(Intent.*EXTRA_SHORTCUT_INTENT*, myIntent);

intent.putExtra(Intent.*EXTRA_SHORTCUT_NAME*, "UninstallTestApp");

/*I explicitly send my intent to the launcher app.  I only knew to do this
by looking
at the source code I found here:;a=blob;f=src/com/android/launcher/;h=e490f9c0f59e609ba70d82a8093c950285865267;hb=cupcake
intent.setComponent(*new* ComponentName("",


However, this seems to remove it from the home screen.  Maybe my vocabulary
is not correct, but I assumed the "home" screen was the thing that displays
widgets and shortcuts that you can fling left and right to see all 3
screens.  The "launcher" was the thing you can scroll up and down on and
displays all applications with

<action android:name=*"android.intent.action.MAIN"* />
<category android:name=*"android.intent.category.LAUNCHER"* />

set in the AndroidManifest.xml.  What I need to do is remove the icon from
the "launcher" not just removing a shortcut from the home screen.  I don't
know if I can programatically over-write what I have set in the Manifest.
That is, I need it to initially be displayed in the "Launcher" but upon
receiving a certain intent, to hide itself.  In essence, to programatically
remove the "android.intent.category.LAUNCHER" from it's category list set in
the AndroidManifest.xml

Thanks for any advice people may have.
On Tue, Jun 16, 2009 at 12:01 PM, <


2. Camera preview different from captured image

Has anyone noticed that the camera preview image field of view is
slightly smaller than the captured image? That is, if, using the
capture application I align the top of the camera preview with some
object in the scene, and then capture, the captured image will extend
noticeably outside the preview.
It appears that, probably, the area of the image sensor where the
image is captured for still photography extends outside the area where
the image is captured for live display.
This would not in itself be a problem but it leads to an issue when I
write an app that overlays the preview with other graphics, for
example a viewfinder window. When the viewfinder is lined up with the
object to be captured in the preview, it will be offset from the
correct position in the still image -- and the viewfinder window will
appear in the incorrect, offset, position in the still frame that is
automatically shown after capture.
This means that it doesn't appear to be possible to give the user
decent positioning guidance near the edge of the preview image. The
offset between the preview image and the still image is at least 10
pixels there.
Has anyone come up with a workaround for this problem?


3. Build Project androd with netbeans

4. Query on Unit testing Android

5. REG: Xml to Wbxml using EAS. Options

6. Re : Lookig for the Android market application

7. ListAdapter getView working in a weird way.