Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've found out, what did I missed :) Since no one answered, I'll leave an answer for everyone, who'll encounter the same problem.</p> <p>It turns out, that the problem described is a generally known Android libraries bug: ViewFlipper fails to handle screen orientation change properly. It have appeared in API 2.1 and continues until 3.0, where it is believed to be fixed. Unfortunatelly, most of today's smartphones suffer from this problem, as usually they have 2.2 or 2.3 onboard.</p> <p>The solution is either to handle screen orientation change manually (see <a href="https://stackoverflow.com/questions/456211/activity-restart-on-rotation-android">Activity restart on rotation Android</a> ) or implement the view changes and animations manually, using FrameLayout, view visibility and animation classes.</p> <p>Another one is to use Eric Burke's SafeViewFlipper class:</p> <pre><code>/** * Works around Android Bug 6191 by catching IllegalArgumentException after * detached from the window. * * @author Eric Burke (eric@squareup.com) */ public class SafeViewFlipper extends ViewFlipper { public SafeViewFlipper(Context context) { super(context); } public SafeViewFlipper(Context context, AttributeSet attrs) { super(context, attrs); } /** * Workaround for Android Bug 6191: * http://code.google.com/p/android/issues/detail?id=6191 * &lt;p/&gt; * ViewFlipper occasionally throws an IllegalArgumentException after * screen rotations. */ @Override protected void onDetachedFromWindow() { try { super.onDetachedFromWindow(); } catch (IllegalArgumentException e) { Log.d(TAG, "SafeViewFlipper ignoring IllegalArgumentException"); // Call stopFlipping() in order to kick off updateRunning() stopFlipping(); } } } </code></pre> <p>You can use it while creating the layout from the code as well as embed it into your xml layout file (you'll have to qualify it fully, eg. &lt;com.myapp.SafeViewFlipper /&gt;).</p> <p>See also <a href="http://code.google.com/p/android/issues/detail?id=6191" rel="nofollow noreferrer">http://code.google.com/p/android/issues/detail?id=6191</a> for more informations.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload