java当我尝试对安卓 google map API映射执行任何操作时,除了显示默认应用程序崩溃之外
我有一个应用程序,在页面中有一个mapfragment。我正试图让片段显示三个标记(最后相机也会将标记框起来,但我只想让它工作!)
所以我这样做:
//Includes//
import com.google.安卓.gms.drive.internal.GetMetadataRequest;
import com.google.安卓.gms.maps.CameraUpdateFactory;
import com.google.安卓.gms.maps.GoogleMap;
import com.google.安卓.gms.maps.MapFragment;
import com.google.安卓.gms.maps.SupportMapFragment;
import com.google.安卓.gms.maps.model.BitmapDescriptorFactory;
import com.google.安卓.gms.maps.model.LatLng;
import com.google.安卓.gms.maps.model.MarkerOptions;
//end includes
//Class level variables//
private GoogleMap googleMap;
private int mapType = GoogleMap.MAP_TYPE_NORMAL;
//end class level variables//
//Begin setting up my map//
FragmentManager fragMan = new FragmentActivity().getSupportFragmentManager();
SupportMapFragment mapFrag = (SupportMapFragment)fragMan.findFragmentById(R.id.frgMap);
googleMap = mapFrag.getMap();
LatLng originCoords = new LatLng(Long.parseLong(hash.get("OriginLat")), Long.parseLong(hash.get("OriginLong")));
LatLng destCoords = new LatLng(Long.parseLong(hash.get("DestLat")), Long.parseLong(hash.get("DestLong")));
LatLng myCoords = new LatLng(googleMap.getMyLocation().getLatitude(), googleMap.getMyLocation().getLongitude());
googleMap.setMapType(mapType);
googleMap.addMarker(new MarkerOptions().position(myCoords).title("My Current Position").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
googleMap.addMarker(new MarkerOptions().position(originCoords).title("Package Origin").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)));
googleMap.addMarker(new MarkerOptions().position(destCoords).title("Package Destination").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
//end setting up map
//Begin the flow of frustrated tears and gnashing of teeth
这就是我能做到的。当我调试它时,它不会抛出任何异常,但我得到了三次被诅咒的“未找到源代码”错误,这并没有给我太多的时间去继续。我应该看什么来解决这个问题?我有一个罐子还是一个。我需要放在安卓 SDK的sources文件夹中的java文件
任何帮助都会很好
共 (0) 个答案