Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] IconGenerator with KLM Layer crashes while tapping on the Icon #317

Closed
dominikue opened this issue Oct 3, 2016 · 2 comments
Closed

Comments

@dominikue
Copy link

dominikue commented Oct 3, 2016

Summary:

I want to show a KML Layer and the IconGenerator.

Steps to reproduce:
Create a KML File as layer and a Icon with the example code from the IconGenerator.
If the user tap on the icon, the apps crashes. Without the kml layers it is working.

  // Adds KML File
    KmlLayer kmlLayer = null;
    try {
        kmlLayer = new KmlLayer(mMap, R.raw.overlay_stadtmitte, getApplicationContext());
        kmlLayer.addLayerToMap();
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

   // Add a marker in Darmstadt and move the camera
    LatLng darmstadt = new LatLng(49.877572, 8.654379);
    mMap.moveCamera(CameraUpdateFactory.newLatLng(darmstadt));
    mMap.moveCamera(CameraUpdateFactory.zoomTo(14));


    // Add a IconLabel
    IconGenerator iconFactory = new IconGenerator(this);
    addIcon(iconFactory, "Default", new LatLng(49.877571, 8.654373));



}

private void addIcon(IconGenerator iconFactory, CharSequence text, LatLng position) {
    MarkerOptions markerOptions = new MarkerOptions().
            icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(text))).
            position(position).
            anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());

    mMap.addMarker(markerOptions);
}

Expected behavior:

The App shows the Icon and the KML Layer without problems.

Observed behavior:

10-03 13:08:27.874 26306-26306/com.ueruem.campusnavitudarmstadt E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                  Process: com.ueruem.campusnavitudarmstadt, PID: 26306
                                                                                  java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
                                                                                      at java.io.StringReader.<init>(StringReader.java:50)
                                                                                      at android.text.HtmlToSpannedConverter.convert(Html.java:758)
                                                                                      at android.text.Html.fromHtml(Html.java:245)
                                                                                      at android.text.Html.fromHtml(Html.java:188)
                                                                                      at com.google.maps.android.kml.KmlRenderer$1.getInfoContents(KmlRenderer.java:592)
                                                                                      at com.google.android.gms.maps.GoogleMap$7.zzi(Unknown Source)
                                                                                      at com.google.android.gms.maps.internal.zzd$zza.onTransact(Unknown Source)
                                                                                      at android.os.Binder.transact(Binder.java:499)
                                                                                      at ue.b(:com.google.android.gms.DynamiteModulesB:112)
                                                                                      at maps.ad.G.a(Unknown Source)
                                                                                      at maps.ad.G.a(Unknown Source)
                                                                                      at maps.D.c.a(Unknown Source)
                                                                                      at maps.D.d.c(Unknown Source)
                                                                                      at maps.ad.S.g(Unknown Source)
                                                                                      at maps.ad.T.b(Unknown Source)
                                                                                      at maps.D.c.a(Unknown Source)
                                                                                      at maps.V.k.a(Unknown Source)
                                                                                      at maps.V.u.d(Unknown Source)
                                                                                      at maps.V.P.onSingleTapConfirmed(Unknown Source)
                                                                                      at maps.z.e$b.onSingleTapConfirmed(Unknown Source)
                                                                                      at maps.z.c$a.handleMessage(Unknown Source)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:154)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Device and Android version:

Nexus 6p with Android 7. The App is <4.2 Android.

Screenshots:

Can be created by pressing the Volume Down and Power Button at the same time on Android 4.0 and higher.

@IncorporateApps
Copy link

I think this is the same as the one we posted, but under different behaviour - #327

How is your KML formatted, with name and description nodes? Please check the #327 and see if you can replicate it once with name and description and once without description and some nodes with description.

@Libby713
Copy link
Contributor

Libby713 commented Dec 5, 2016

Fixed in 0d92651

@Libby713 Libby713 closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants