Fix null string crash

This commit is contained in:
Leith Bade
2014-11-18 22:47:57 +11:00
parent eaece4f8bb
commit 900f6e87fa
5 changed files with 48 additions and 9 deletions

View File

@@ -1,11 +1,13 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="${packageName}.${activityClass}" >
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="${packageName}.${activityClass}">
<view
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.mapbox.mapboxgl.lib.MapView"
android:id="@+id/map" />
android:id="@+id/map"
app:styleUrl="asset://styles/styles/bright-v6.json"/>
</merge>

View File

@@ -86,7 +86,7 @@ public class MapView extends SurfaceView {
private boolean mZoomEnabled = true;
private boolean mScrollEnabled = true;
private boolean mRotateEnabled = true;
private String mStyleUrl = "asset://styles/styles/bright-v6.json";
private String mStyleUrl;
//
// Constructors
@@ -137,7 +137,6 @@ public class MapView extends SurfaceView {
// Create the NativeMapView
mNativeMapView = new NativeMapView(this, cachePath, dataPath, apkPath);
mNativeMapView.setStyleUrl(mStyleUrl);
// Load the attributes
TypedArray typedArray = context.obtainStyledAttributes(attrs,
@@ -164,8 +163,6 @@ public class MapView extends SurfaceView {
R.styleable.MapView_debugActive, false));
setStyleUrl(typedArray.getString(
R.styleable.MapView_styleUrl));
setAccessToken(typedArray.getString(
R.styleable.MapView_accessToken));
} finally {
typedArray.recycle();
}

View File

@@ -8,7 +8,6 @@
<attr name="rotateEnabled" format="boolean" />
<attr name="debugActive" format="boolean" />
<attr name="styleUrl" format="string" />
<attr name="accessToken" format="string" />
<declare-styleable name="MapView">
<attr name="centerLongitude" />
@@ -20,6 +19,5 @@
<attr name="rotateEnabled" />
<attr name="debugActive" />
<attr name="styleUrl" />
<attr name="accessToken" />
</declare-styleable>
</resources>