Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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