PhoneGap – Forcing Landscape orientation

Have you tried this? android:screenOrientation=”portrait” Inside the AndroidManifest.xml file, where you have declared your activity, just add the above line. For example: <activity android:name=”.Activity.SplashScreenActivity” android:label=”@string/app_name” android:screenOrientation=”portrait”> <intent-filter> <action android:name=”android.intent.action.MAIN” /> <category android:name=”android.intent.category.LAUNCHER” /> </intent-filter> </activity>

iOS 6 rotations: supportedInterfaceOrientations doesn´t work?

If your ViewController is a child of a UINavigationController or UITabBarController, then it is the parent that is your problem. You might need to subclass that parent view controller, just overriding those InterfaceOrientation methods as you’ve shown in your question EDIT: Example for portrait only TabBarController @interface MyTabBarController : UITabBarController { } @end @implementation MyTabBarController … Read more

Retain the Fragment object while rotating

By default Android will retain the fragment objects. In your code you are setting the homeFragment in your onCreate function. That is why it is allways some homeFragment or fl what ever that you set in onCreate. Because whenever you rotate, the onCreate will execute and set your fragment object to the first one So … Read more

How to save custom ArrayList on Android screen rotate?

You do not need to create a new class to pass an ArrayList of your custom objects. You should simply implement the Parcelable class for your object and use Bundle#putParcelableArrayList() in onSaveInstanceState() and onRestoreInstanceState(). This method will store an ArrayList of Parcelables by itself. Because the subject of Parcelables (and Serializables and Bundles) sometimes makes … Read more

RecyclerView: Inconsistency detected. Invalid item position

I had a (possibly) related issue – entering a new instance of an activity with a RecyclerView, but with a smaller adapter was triggering this crash for me. RecyclerView.dispatchLayout() can try to pull items from the scrap before calling mRecycler.clearOldPositions(). The consequence being is that it was pulling items from the common pool that had … Read more