1

I am trying to integrate a Google Maps View with Litho, and I have created a MountSpec for this. I have two issues with this.

Firstly, I need to run some background thread code in the OnPrepare Method, but as a result, I cannot assign the result of the background task to the Output object. What is a better way to handle this?

Secondly, when the view renders, it throws an error (Stacktrace below).

java.lang.ClassCastException: com.google.android.gms.location.places.internal.zzas cannot be cast to android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener at com.facebook.litho.widget.Recycler.onPrepare(Recycler.java:98) at com.facebook.litho.ComponentLifecycle.createLayout(ComponentLifecycle.java:251) at com.facebook.litho.LayoutState.createTree(LayoutState.java:1237) at com.facebook.litho.LayoutState.createAndMeasureTreeForComponent(LayoutState.java:1406) at com.facebook.litho.LayoutState.calculate(LayoutState.java:928) at com.facebook.litho.ComponentTree.calculateLayoutState(ComponentTree.java:1235) at com.facebook.litho.ComponentTree.measure(ComponentTree.java:545) at com.facebook.litho.LithoView.onMeasure(LithoView.java:218) at android.view.View.measure(View.java:17562) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1658) at android.view.View.measure(View.java:17562) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5608) at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714) at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90) at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1391) at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784) at android.view.View.measure(View.java:17562) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5608) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)

This is the MountSpec that is throwing the error:

mapView.getMapAsync(googleMap -> {
            Places.GeoDataApi.getPlaceById(googleApiClient, locationId)
                    .setResultCallback(places -> {
                        googleMap.addMarker(
                                new MarkerOptions()
                                        .position(new LatLng(0,0))
                        );
                        googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
                    });
        });

0 Answers0