screen-rotation

PhoneGap - Forcing Landscape orientation

谁都会走 提交于 2019-11-26 04:51:34
问题 I started looking into PhoneGap yesterday and created a simple \"marble\" rolling around while tilting the phone. I am currently developing on Android but I want the orientation to stay as landscaping instead of moving when the phone gets spun around. Is there a way of doing this? Manifest: <?xml version=\"1.0\" encoding=\"utf-8\"?> <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.phonegap.helloworld\" android:versionCode=\"1\" android:versionName=\"1.0\" >

How to handle an AsyncTask during Screen Rotation?

ε祈祈猫儿з 提交于 2019-11-26 03:13:32
I read a lot on how to save my instance state or how to deal with my activity getting destroyed during screen rotation. There seem to be a lot of possibilities but I haven't figured out which one works best for retrieving results of an AsyncTask. I have some AsyncTasks that are simply started again and call the isFinishing() method of the activity and if the activity is finishing they wont update anything. The problem is that I have one Task that does a request to a web service that can fail or succeed and restarting the task would result in a financial loss for the user. How would you solve

How to save custom ArrayList on Android screen rotate?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 02:52:00
问题 I have an ArrayList with custom objects that I would like to be able to save and restore on a screen rotate. I know that this can be done with onSaveInstanceState and onRestoreInstanceState if I were to make the ArrayList its own class, which implements either Parcelable or Serializable ... But is there a way to do this without creating another class? 回答1: 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

How to handle an AsyncTask during Screen Rotation?

微笑、不失礼 提交于 2019-11-26 01:12:59
问题 I read a lot on how to save my instance state or how to deal with my activity getting destroyed during screen rotation. There seem to be a lot of possibilities but I haven\'t figured out which one works best for retrieving results of an AsyncTask. I have some AsyncTasks that are simply started again and call the isFinishing() method of the activity and if the activity is finishing they wont update anything. The problem is that I have one Task that does a request to a web service that can fail

RecyclerView: Inconsistency detected. Invalid item position

久未见 提交于 2019-11-26 01:11:19
问题 Our QA has detected a bug: when rotating the Android device (Droid Turbo), the following RecyclerView-related crash happened: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 2(offset:2).state:3 To me, it looks like an internal error inside RecyclerView, as I can\'t think of any way of this being caused directly by our code... Has anyone encountered this problem? What would be the solution? A brutal workaround could be perhaps to catch the exception when it