我试图创建non-Activity
类显示my current location, get latitude/longitude, show markers
....上Google Maps V2
但始终其报告的错误:谷歌地图V2-无法解析法getSupportFragmentManager()在非活性类
无法解析方法getSupportFragmentManager ()
我想:
我的代码部分
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 from the fragment
googleMap = map.getMap();
// Enabling MyLocation Layer of Google Map
googleMap.setMyLocationEnabled(true);
}
//.......................
有什么建议吗?
它解决了只删除该行,由于答案,但它解决了。 – Aspicas