0
android studio를 사용하여 예약 앱을 만들고 있습니다.지도 조각을 추가했지만 오류 메시지가 표시됩니다. getmap()은 사용되지 않으며 대신 getMapAsync()를 사용하고 싶습니다. 나는 그것을 시도했지만 더 많은 오류가 발생했습니다. 제발 도와주세요. 감사.getmap()은 사용되지 않으며 getmapAsync?
public class HomeActivity extends Fragment implements View.OnClickListener,GoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener,GoogleMap.OnMapClickListener,GoogleMap.OnMarkerDragListener,{
private GoogleMap map;
private static View v;
private GoogleApiClient mGoogleApiClient;
double latitude,longitude;
boolean centeronCurrent= true, syncWithServer= true, trackDriverBoolean= true, waitForRideToEnd=true;
TextView selectPickup, statusText;
Button requesttaxi;
LatLng currentLocation;
int shortestTime;
int nearbyTaxis,taxicount;
String driverid="", currentRideid="";
ArrayList<Marker> markers= new ArrayList<Marker>();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (v!= null){
ViewGroup parent= (ViewGroup) v.getParent();
if (parent!= null)
parent.removeView(v);
}
try {
v= inflater.inflate(R.layout.home,container,false);
}
catch (InflateException e){
e.printStackTrace();
}
map= ((SupportMapFragment)getChildFragmentManager().findFragmentById(R.id.map)).getMap();
map.setMyLocationEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.setOnMapClickListener(this);
map.setOnMarkerDragListener(this);
requesttaxi= (Button) v.findViewById(R.id.request_taxi);
requesttaxi.setOnClickListener(this);
statusText=(TextView) v.findViewById(R.id.status_text);
statusText.setVisibility(View.INVISIBLE);
SharedPreferences sp = getActivity().getSharedPreferences("Session", Context.MODE_PRIVATE);
SharedPreferences.Editor editor;
editor=sp.edit();
String location= sp.getString("location","");
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
selectPickup= (TextView) v.findViewById(R.id.select_location);
selectPickup.setOnClickListener(this);
if (location.equals(""))
{
selectPickup.setText("Select Pick up Location");
}
else {
String latstr= sp.getString("locationlat","");
String longstr= sp.getString("locationlong","");
latitude= Double.parseDouble(latstr);
longitude= Double.parseDouble(longstr);
selectPickup.setText(location);
editor.putString("location","");
editor.putString("locationlat","");
editor.putString("locationlong","");
editor.commit();
centeronCurrent=false;
}
mGoogleApiClient.connect();
return v;
}
당신의 오류가 무엇입니까? 당신의 logcat pls를 게시하십시오! – alway5dotcom