Skip to content

Instantly share code, notes, and snippets.

@pwittchen
Last active December 11, 2015 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwittchen/4589974 to your computer and use it in GitHub Desktop.
Save pwittchen/4589974 to your computer and use it in GitHub Desktop.
Fixing bug with disappearing map overlay after zoom in Android.
public class ExamplaryMapActivity extends RoboMapActivity {
@InjectView(R.id.mapview)
private MapView mapView;
@Override
protected void onCreate(Bundle bundle) {
enableHWAccel(mapView, false);
}
@TargetApi(11)
private static void enableHWAccel(MapView mapView, boolean enable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
int type = enable ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_SOFTWARE;
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment