文法上の誤りがあれば、それをどうぞ。 私は断片の中でGoogleマップを見るためにチュートリアルに従いましたが、何かが間違っていました。メソッド「getMapAsync」を解決できません
これは断片で引っ掛けて、私のファイルの.javaです:
public class MapFragment extends Fragment implements OnMapReadyCallback{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_map, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
MapFragment fragment = (MapFragment)getChildFragmentManager().findFragmentById(R.id.map);
fragment.getMapAsync(this); //Here i get the error
}
@Override
public void onMapReady(GoogleMap googleMap) {
}
}
これは、レイアウトフラグメントである:
<fragment
android:id="@+id/map"
android:layout_width="wrap_content"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"></fragment>
どうしたの?
ありがとうございました!
正確に何が間違っていますか? –
私はマップを開くと、このエラーが表示されます:http://pastebin.com/RZehk7XC – RvGPredator