Android studio 尝试调用虚拟方法';com.google.android.gms.location.LocationRequest

Android studio 尝试调用虚拟方法';com.google.android.gms.location.LocationRequest,android-studio,location,Android Studio,Location,公共视图onCreateView(@NonNull layoutiner充气机, 视图组容器,捆绑包savedInstanceState){ homeViewModel= 新建ViewModelProvider(this.get)(HomeViewModel.class); 视图根=充气机。充气(R.layout.fragment\u home,container,false); //这里 init(); mapFragment=(SupportMapFragment)getChildFragm

公共视图onCreateView(@NonNull layoutiner充气机, 视图组容器,捆绑包savedInstanceState){ homeViewModel= 新建ViewModelProvider(this.get)(HomeViewModel.class); 视图根=充气机。充气(R.layout.fragment\u home,container,false); //这里 init(); mapFragment=(SupportMapFragment)getChildFragmentManager().findFragmentById(R.id.map); getMapAsync(这个); 返回根; }

您好,欢迎来到SO:),请在问题主体中添加一点解释
private void init() {
    locationCallback = new LocationCallback();
    locationRequest.setSmallestDisplacement(10f);
    locationRequest.setInterval(5000);
    locationRequest.setFastestInterval(3000);
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

    locationCallback = new LocationCallback() {
        @Override
        public void onLocationResult(LocationResult locationResult) {
            super.onLocationResult(locationResult);
            LatLng newposition = new LatLng(locationResult.getLastLocation().getLatitude(),
                    locationResult.getLastLocation().getLatitude());
            mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newposition, 18f));
        }


    };