I want to have SupportMapFragment in one of my Activity. I add this fragment directly to layout xml and this layout set as content view. But when Activity is launched for th
Similar to the other solutions here, but using RxJava + RxAndroid.
Just call this snippet from the launcher activity onCreate.
Observable.fromCallable(new Callable() {
@Override
public Void call() {
MapView mapView = new MapView(LaunchActivity.this); // Replace LaunchActivity with appropriate activity's name
mapView.onCreate(null);
return null;
}
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
new Action1() {
@Override
public void call(Void ignorable) {
Log.i("Google Maps", "Initialised Google Maps.");
}
}, new Action1() {
@Override
public void call(Throwable ignorable) {
Log.w("Google Maps", "[EXPECTED] Initialized Google Maps but got: " + ignorable.getMessage());
}
});