Performance Enhancement:
Previously I saved ALL images in drawable
folder, this might be the reason why the map first l
I'm using a very hackish but effective way in my application, but it works good. My mapFragment is not displayed right after the app launches! Otherwise this would not make sense.
Put this in your launcher activity's onCreate:
// Fixing Later Map loading Delay
new Thread(new Runnable() {
@Override
public void run() {
try {
MapView mv = new MapView(getApplicationContext());
mv.onCreate(null);
mv.onPause();
mv.onDestroy();
}catch (Exception ignored){
}
}
}).start();
This will create a mapview in an background thread (far away from the ui) and with it, initializes all the google play services and map data.
The loaded data is about 5MB extra.
If someone has some ideas for improvements feel free to comment please !
Java 8 Version:
// Fixing Later Map loading Delay
new Thread(() -> {
try {
MapView mv = new MapView(getApplicationContext());
mv.onCreate(null);
mv.onPause();
mv.onDestroy();
}catch (Exception ignored){}
}).start();