Performance Enhancement:
Previously I saved ALL images in drawable folder, this might be the reason why the map first l
Just to add to @Xyaren's answer, I needed it to work for SupportFragment which seemed to require some extra steps. Have your activity implement OnMapReadyCallback.
In your onCreate:
new Thread(() -> {
try {
SupportMapFragment mf = SupportMapFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.add(R.id.dummy_map_view, mf)
.commit();
runOnUiThread(() -> mf.getMapAsync(SplashActivity.this));
}catch (Exception ignored){
Timber.w("Dummy map load exception: %s", ignored);
}
}).start();
You'll have to implement this:
@Override
public void onMapReady(GoogleMap googleMap) {
// Do nothing because we only want to pre-load map.
Timber.d("Map loaded: %s", googleMap);
}
and in your activity layout:
It needs to go through all the steps including the transaction for Google Play Services to download the map data.