我试图在AsyncTask中获取地图,在片段内的this
行mapFragment.getMapAsync(this);
处提到错误
private class BackGroundTaskForUserProfile extends AsyncTask<String, Void, Void> {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
MapFragment mapFragment = (MapFragment) getActivity().getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
答案 0 :(得分:2)
mapFragment.getMapAsync(getContext());