안녕하세요 저는 현재 학교 프로젝트를하고 있으며 버그가있는 곳을 잘 모릅니다. 내 코드가 잘못되었다고 생각하지 않습니다. 제발 도와주세요. 내 코드는 입니다. 이것은 제가 사용하는 모든 프로젝트입니다. 내가 된 CameraUpdate이CameraUpdateFactory.newLatLngZoom returns null
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(route.startLocation, 16));
//((TextView) findViewById(R.id.textView2)).setText(route.duration.text);
//((TextView) findViewById(R.id.textView3)).setText(route.distance.text);
originMarkers.add(googleMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue))
.title(route.startAddress)
.position(route.startLocation)));
destinationMarkers.add(googleMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.end_green))
.title(route.endAddress)
.position(route.endLocation)));
PolylineOptions polylineOptions = new PolylineOptions().
geodesic(true).
color(Color.BLUE).
width(10);
for (int i = 0; i < route.points.size(); i++)
polylineOptions.add(route.points.get(i));
polylinePaths.add(googleMap.addPolyline(polylineOptions));
routes.clear();
}
}
을 던져하려고하는 데이터 유형 경로의 종류를 알고있는 경우에 잘 모릅니다, drive.google.com/open?id=0B0MY4kATEXqlMDQyZWprRDhmeUU
private void sendRequest() {
String origin = etOrigin.getText().toString();
String destination = etDestination.getText().toString();
String[] destinationArray = {"v.mapa","Vasra","Culiat"};
if (origin.isEmpty()) {
Toast.makeText(this, "Please enter origin address!", Toast.LENGTH_SHORT).show();
return;
}
if (destination.isEmpty()) {
Toast.makeText(this, "Please enter destination address!", Toast.LENGTH_SHORT).show();
return;
}
try {
new DirectionFinder(this, origin, destinationArray[2]).execute();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
new DirectionFinder(this, destinationArray[2], destinationArray[1]).execute();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
@Override
public void onDirectionFinderSuccess(List<Route> routes) {
progressDialog.dismiss();
progressDialog.dismiss();
polylinePaths = new ArrayList<>();
originMarkers = new ArrayList<>();
destinationMarkers = new ArrayList<>();
for (Route route : routes) {
Toast.makeText(
MainActivity.this,
route.startLocation.toString(),
Toast.LENGTH_LONG).show();
//이 다음 라인을 ID LIKE 문자열로, 반환 안내
그 다음
Process: com.hci_thesis.thesis_dolph, PID: 4479
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.moveCamera(com.google.android.gms.maps.CameraUpdate)' on a null object reference
at com.hci_thesis.thesis_dolph.MainActivity.onDirectionFinderSuccess(MainActivity.java:269)
at mods.DirectionFinder.parseJSon(DirectionFinder.java:129)
at mods.DirectionFinder.access$100(DirectionFinder.java:25)
at mods.DirectionFinder$DownloadRawData.onPostExecute(DirectionFinder.java:87)
at mods.DirectionFinder$DownloadRawData.onPostExecute(DirectionFinder.java:58)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
T_T하지만 내 코드 선생님과 아무 문제가 없습니다. –