java - android.content.res.Resources$NotFoundException: Resource ID #0x7f020278 -
i'm new android programing, , trying use map current location, when @ logcat, see following error:
runtimeexception android.content.res.resources$notfoundexception: resource id #0x7f020278 @ android.content.res.resources.getvalue(resources.java:2329) @ android.content.res.resources.startrc(resources.java:1057) @ android.app.activitythread$mrunnable.run(activitythread.java:2477) @ java.lang.thread.run(thread.java:818) 07-15 18:40:16.624 13526-13526 com.example.paul.mapasxavo e/viewrootimpl﹕ senduseractionevent() mview == null
the java code in mapsactiviy class is:
public class mapsactivity extends fragmentactivity { // might null if google play services apk not available. private googlemap mmap; private sensormanager sensormanager; private sensor accelerometer; locationmanager locationmanager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps); setupmapifneeded(); } @override protected void onresume() { super.onresume(); setupmapifneeded(); } private void setupmap() { location_service locationmanager = (locationmanager)getsystemservice(location_service); criteria criteria = new criteria(); string provider = locationmanager.getbestprovider(criteria, true); location location = locationmanager.getlastknownlocation(provider); mmap.clear(); latlng currentposition = new latlng(location.getlatitude(), location.getlongitude()); mmap.addmarker(new markeroptions().position(currentposition).title("yo")); mmap.animatecamera(cameraupdatefactory.newlatlngzoom(currentposition, 13)); mmap.setmylocationenabled(true); log.v("mapaactivity", currentposition.tostring()); } }
this xml file
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/map" tools:context="com.example.paul.mapasxavo.mapsactivity" android:name="com.google.android.gms.maps.supportmapfragment" />
what doing wrong?
i got same error solved simple way !. check xml layout if looks abc.xml(xlarge-mdpi) delete , create new 1 abc.xml in default layout folder make sure should not previous one. if answer helps you. vote up! happy coding!
Comments
Post a Comment