3

I am having a strange issue related to Android 5 and Google Maps combined with a Viewpager and Fragments, hoping to get some good ideas from all of you..

Screenshot of the problem: http://postimg.org/image/6wzssbdbr/ (no rep for inlining yet)

Situation:

  • Main Activity with a Viewpager that has a number of Fragments
  • One of the Fragments has a MapView inside it with all lifecycle methods forwarded; replace MapView with MapsFragment and the issue is the same
  • Open a new Activity, as long as the new Activity is not using too much memory (I assume), the onDestroy of the Main Activity is not called and the glitch happens, if onDestroy is called, the glitch does not happen
  • That second Activity has an input field for a card number and when this Activity is opened, I see the screenshot above.

If I go back from the second Activity to the first I also get something strange, a bottom part of the screen is copied to the top and shown there with some static around it.

Devices with Android 4 don't have the problem, I am targeting the latest SDK, using the latest build tools.

If I remove the Fragment in the Viewpager with the Google Maps inside it, no issue.

The only thing that did work is android:hardwareAccelerated='false' but as you might imagine this slows down the app..

Any suggestions/ideas are welcome.. I tried around 4-5 different things so far and only android:hardwareAccelerated works.

Thanks for reading,

Danny

Edit:

(Not enough rep to post more than 2 links, so links below without the code.google.com in front of it) Google code issues:

  • My issue is reported here] -> /p/gmaps-api-issues/issues/detail?id=7391 because I thought it was maps specific

  • Similar issue found here -> /p/android/issues/detail?id=81832 reported in Android bugs

Stackoverflow similar issue: Android SystemUI glitches

Danny
  • 31
  • 4

1 Answers1

0

Add:

android:hardwareAccelerated="false"

to your Activity or Application manifest entry. This workaround disables hardware accelerated graphics, so don't take this lightly. There is at least one bug report into Google for similar visual glitches to yours, hopefully they get this resolved quickly.

I wouldn't recommend putting this into a shipping app, only to prove or disprove that your drawing glitches are due to problems with the underlying hardware acceleration system.

You can also try disabling hardware acceleration at the View level via:

view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

in particular if you have WebView's, setting layer type to software on WebView's in my app went a long way towards resolving UI glitches.

CSmith
  • 13,318
  • 3
  • 39
  • 42
  • Thanks for suggesting this, as I said above "only android:hardwareAccelerated works." so I am using that now, setLayerType for some odd reason did not work.. – Danny Dec 19 '14 at 09:49