谷歌地图android v2 MarkerOption图标无法接受StateListDrawable

时间:2012-12-06 16:53:43

标签: android google-maps-mobile statelistdrawable

我想将StateListDrawable添加为标记图标,如下所示:

MarkerOptions marker = new MarkerOptions().position(xy).title("Marker").icon(BitmapDescriptorFactory.fromResource(R.drawable.state));

然而,它给了我一个空指针异常,任何解决方法?

12-06 18:52:51.152: E/AndroidRuntime(3264): Caused by: java.lang.NullPointerException
12-06 18:52:51.152: E/AndroidRuntime(3264):     at maps.y.bw.a(Unknown Source)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at maps.y.bw.b(Unknown Source)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at maps.y.bw.a(Unknown Source)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at maps.y.ae.addMarker(Unknown Source)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at com.google.android.gms.maps.internal.IGoogleMapDelegate$Stub.onTransact(IGoogleMapDelegate.java:167)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at android.os.Binder.transact(Binder.java:279)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.addMarker(Unknown Source)
12-06 18:52:51.152: E/AndroidRuntime(3264):     at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)

thx!

0 个答案:

没有答案