java - getMap() returning null -


my getmap() method returning null. why method returning null? looked on android developers documentation make sure i'm using method correctly. here line of code i'm using map:

mmap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview)).getmap(); 

here java code:

private projectionproxy proxy = new projectionproxy();  private googlemap mmap;  @override protected void oncreate(bundle load) {      super.oncreate(load);      setcontentview(r.layout.fragment_ride_tracking);      mmap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview)).getmap();      log.e("ridetracking", "google map value:"+mmap);      if (mmap != null) {          proxy.setprojection(mmap.getprojection());     } 

here xml code particular piece of code:

   <fragment      android:id="@+id/mymapview"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:name="com.google.android.gms.maps.mapfragment"/> 

here logcat output:

05-09 12:49:34.282: w/googleplayservicesutil(5928): google play services out of date.  requires 3027100 found 2012110 05-09 12:49:34.282: e/ridetracking(5928): google map value:null 05-09 12:49:34.302: e/ogt.gpsloggerservicemanager(5928): no gpsloggerremote service connected manager 05-09 12:49:34.322: w/dalvikvm(5928): unable resolve superclass of lcom/android/gpstracker/viewer/fixedmylocationoverlay; (2174) 05-09 12:49:34.322: w/dalvikvm(5928): link of class 'lcom/android/gpstracker/viewer/fixedmylocationoverlay;' failed 05-09 12:49:34.322: w/dalvikvm(5928): unable resolve superclass of lcom/android/gpstracker/viewer/fixedmylocationoverlay; (2174) 

any appreciated!

try changing that

googlemap googlemap;  mapfragment fm = (mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview);   googlemap = fm.getmap(); 

if running in emulator need install 2 apk files (read post)

if have tweaked emulator , installed 2 files have change google_play_services_lib version 4 (download here)

just replace new google_play_services_lib old version#4 in eclipse , reference project.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -