java - Mapbox Android SDK Null Pointer exception on screen orintation change and crash on API 25 -
i getting null pointer exception when screen orientation changes vertical horizontal (all other api's) , upon launch on api25 .
here stack trace , code in question.
09-11 20:24:57.386 2794-2794/com.example.andrew.satwatch e/androidruntime: fatal exception: main process: com.example.andrew.satwatch, pid: 2794 java.lang.nullpointerexception: attempt invoke virtual method 'void com.mapbox.mapboxsdk.maps.mapboxmap.addsource(com.mapbox.mapboxsdk.style.sources.source)' on null object reference @ com.example.andrew.satwatch.mainactivity.addvectorlayersource(mainactivity.java:1018) @ com.example.andrew.satwatch.mainactivity.addcountries(mainactivity.java:988) @ com.example.andrew.satwatch.mainactivity.onitemselected(mainactivity.java:423)
code in question
public linelayer addvectorlayersource(string url, string sourcekey, string sourceid){ mytileset = new tileset(sourceid+"_tileset", url); map.addsource(new vectorsource(sourceid+"_data", mytileset)); linelayer linedata = new linelayer(sourceid+"-data", sourceid+"_data"); linedata.setsourcelayer(sourcekey); // map.addlayer(linedata); return linedata; } public void addcountries(){ linelayer layer = addvectorlayersource("https://storage.googleapis.com/satsquatch-overlays-test/states_countries/{z}/{x}/{y}.pbf","mergedgeojson","country"); layer.setproperties( linejoin(property.line_join_round), linecap(property.line_cap_round), linecolor(color.parsecolor("#2f82b7")), linewidth(1.25f) ); layer.setmaxzoom(10); layer.setminzoom(0); map.addlayer(layer); }
Comments
Post a Comment