android - Google Maps v2- Cannot resolve method getSupportFragmentManager() on non-Activity class -


i'm trying create non-activity class show my current location, latitude/longitude, show markers....on google maps v2but reports error:

cannot resolve method getsupportfragmentmanager()

i tried:

part of code

public final class adddatagmapsv2 {      private static context context;      public adddatagmapsv2(context context) {         this.context = context;     }       public void showmap(supportmapfragment map, googlemap googlemap) {           //show map         //line error below         map = (supportmapfragment) context.getsupportfragmentmanager().findfragmentbyid(r.id.map);          // getting googlemap object fragment         googlemap = map.getmap();          // enabling mylocation layer of google map         googlemap.setmylocationenabled(true);      }     //....................... 

any suggestions?

solution

i find solution question, deleting line:

 map = (supportmapfragment) context.getsupportfragmentmanager().findfragmentbyid(r.id.map); 

and later declare on principal activity...simple.


Comments