大家好,请帮帮我。我不知道该怎么做
我也完成了findall(Score, clause(test(5, Score), Body), Scores),
max_member(MaxScore, Scores),
test(5, MaxScore).
答案 0 :(得分:1)
不推荐使用getMap()。使用如下的getMapAsync()。
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
答案 1 :(得分:0)
这两个错误都不同。
mapFragment.getMapAsync(this)
setMyLocationEnable
需要检查ACCESS_COARSE_LOCATION
和ACCESS_FINE_LOCATION
的运行时权限。试试这个:
mapFragment.getMapAsync(new OnMapReadyCallback(){
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
}
});
对于问题2,请使用此
if (googleMap != null) {
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
googleMap.setMyLocationEnabled(true);
}