gpt4 book ai didi

java - 错误 "Attempt to invoke virtual method ' 双 java.lang.Double.doubleValue( )' on a null object reference"

转载 作者:太空狗 更新时间:2023-10-29 16:27:14 24 4
gpt4 key购买 nike

<分区>

我刚刚在通过访问 SqliteDatabase 的纬度和经度来显示 map 时遇到了问题。

当我运行它时,我在 .target(new LatLng(latitude, longitude)) 行收到上述错误。任何帮助,将不胜感激。

 import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import static com.example.kod45.refapp.R.id.lat;
import static com.example.kod45.refapp.R.id.longitude;

public class Map extends FragmentActivity implements OnMapReadyCallback {
Double latitude;
Double longitude;
private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;

// Add a marker in Tallaght and move the camera

CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(latitude, longitude)) // Sets the center of the map to Mountain View
.zoom(17) // Sets the zoom
.bearing(90) // Sets the orientation of the camera to east
.tilt(30) // Sets the tilt of the camera to 30 degrees
.build(); // Creates a CameraPosition from the builder
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

Intent intent = getIntent();
intent.putExtra("latitude", latitude);
intent.putExtra("longitude", longitude);
// LatLng sydney = new LatLng(latitude, longitude);

}
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com