android-orientation
Android emulator not rotating to landscape
Some of the emulator targets like 4.4 (API level 19) and 2.3 have a bug. Change your emulator to target version 4.2 or 4.3 and try to change the orientation. See the history of this bug: https://code.google.com/p/android/issues/detail?id=13189 Related question: Impossible to rotate the emulator with android 4.4
EXIF orientation tag value always 0 for image taken with portrait camera app android
I also faced same issue in Samsung devices, later I implemented ExifInterface and solved successfully. In any mode images will be shot it will always store in portrait mode only, and while fetching too returning in portrait mode. below of code I used to achieve my goal, I implemented within back camera, not sure about … Read more
Why has `android:screenOrientation=”behind”` no effect in android 4.1.2?
android:targetSdkVersion=”16″ Remove this statement in your manifest file, because SDKVersion=16 is only available for v4.0.
Android VideoView orientation change with buffered video
EDIT: (June 2016) This answer is very old (I think android 2.2/2.3) and probably is not as relevant as the other answers below! Look to them first unless you’re dev-ing on legacy Android 🙂 I was able to narrow down the problem to the onMeasure function in the VideoView class. By creating a child class … Read more
Controlling the camera to take pictures in portrait doesn’t rotate the final images
The problem is when I saved the image I didn’t do well. @Override public void onPictureTaken(byte[] data, Camera camera) { String timeStamp = new SimpleDateFormat( “yyyyMMdd_HHmmss”).format( new Date( )); output_file_name = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + File.separator + timeStamp + “.jpeg”; File pictureFile = new File(output_file_name); if (pictureFile.exists()) { pictureFile.delete(); } try { FileOutputStream fos = new FileOutputStream(pictureFile); … Read more
Changing number of columns with GridLayoutManager and RecyclerView
If you have more than one condition or use the value in multiple places this can go out of hand pretty fast. I suggest to create the following structure: res – values – integers.xml – values-land – integers.xml with res/values/integers.xml being: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <integer name=”gallery_columns”>2</integer> </resources> and res/values-land/integers.xml being: <?xml version=”1.0″ encoding=”utf-8″?> <resources> … Read more
How to fix layout orientation to vertical?
In your AndroidMainfest.xml file find the tags of the activities you wish to lock to a given rotation, and add this attribute: android:screenOrientation=”portrait”
Fool-proof way to handle Fragment on orientation change
You are creating a new fragment every time you turn the screen in your activity onCreate(); But you are also maintaining the old ones with super.onCreate(savedInstanceState);. So maybe set tag and find the fragment if it exists, or pass null bundle to super. This took me a while to learn and it can really be … Read more
Restoring state of TextView after screen rotation?
If you want to force your TextView to save its state you must add freezesText attribute: <TextView … android:freezesText=”true” /> From documentation on freezesText : If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is … Read more