Note that there are some explanatory texts on larger screens.

plurals
  1. POCrash with hardware acceleration of fragment transition animations
    primarykey
    data
    text
    <p>I am using a slide-in / slide-out animation for fragment transitions. To smoothen out these animations I am using hardware acceleration by setting the layer type of the fragment to <code>View.LAYER_TYPE_HARDWARE</code> before the animation and back to <code>View.LAYER_TYPE_NONE</code> if the animation is completed.</p> <pre><code>public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { if (getFragmentManager().getBackStackEntryCount() == 0) { return super.onCreateAnimation(transit, enter, nextAnim); } if (nextAnim == 0) { nextAnim = enter ? android.R.anim.slide_in_left : android.R.anim.slide_out_right; } Animation animation = AnimationUtils.loadAnimation(getActivity(), nextAnim); // smoothening animations if (animation != null) { getView().setLayerType(View.LAYER_TYPE_HARDWARE, null); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { if (getView() != null) { getView().setLayerType(View.LAYER_TYPE_NONE, null); } } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationStart(Animation arg0) { } }); } return animation; } </code></pre> <p>I recently discovered, that my app crashes randomly on some transitions only on some devices with <code>Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)</code>. I could narrow down the error to the line where the layer-type is set to <code>HARDWARE</code>. If I set it to <code>NONE</code> or <code>SOFTWARE</code> everything works fine.</p> <p>What am I doing wrong? Thanks in advance for any help!</p> <p>EDIT: This seems to be an Android 4.3-specific bug. These crashes can be reproduced on 4.3 devices and the 4.3 emulator (host-GPU enabled). It is fine on Android 4.1, 4.2.2 and 4.4.</p> <p>I am disabling hardware acceleration for 4.3 as a workaround. Hardware acceleration is only needed on older devices with slower processing power in my use case - and these are very unlikely to have 4.3. But anyways, it would be nice if someone had an idea how this is really fixed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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