-6

Here is the link of my activity, in wich appears thet error: cannot resolve method getMap(); I hope that you guys can help me on solve it. Thank you


why when i put this appears public on red ?

        public class AddPostActivity extends FragmentActivity implements OnMapReadyCallback {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.add_post_activity);

            MapFragment fm = (MapFragment) getFragmentManager().findFragmentById(R.id.maps_fragment);
            fm.getMapAsync(this);
        }

        @Override
        public void onMapReady(GoogleMap googleMap) {

            map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            mUiSettings = map.getUiSettings();

            mUiSettings.setCompassEnabled(true);
            mUiSettings.setMyLocationButtonEnabled(false);
        }
    }
ChrisF
  • 134,786
  • 31
  • 255
  • 325
MenjeHer
  • 33
  • 7
  • In the future, please put the code *in the question*, not via a link to an external site. – CommonsWare Jul 09 '16 at 13:48
  • Try to localize the error and post your efforts and the relevant section of your sourse code. – Tobias Uhmann Jul 09 '16 at 13:50
  • Possible duplicate of [Cannot resolve method 'getMap()'](http://stackoverflow.com/questions/38232747/cannot-resolve-method-getmap) – Daniel Nugent Jul 09 '16 at 15:33
  • @DanielNugent can u see my other question under this question i have added the getMapAsync but appears public on read line, i have added this pubblic class into my initial pubblic class – MenjeHer Jul 09 '16 at 15:44

1 Answers1

1

SupportMapFragment no longer supports getMap(). Please use getMapAsync().

Note that the same holds true for MapFragment -- getMap() has been removed from the SDK.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • How can i chane that – MenjeHer Jul 09 '16 at 14:08
  • @MenjeHer: Replace `getMap()` with `getMapAsync()`. Provide [an `OnMapReadyCallback`](https://developers.google.com/android/reference/com/google/android/gms/maps/OnMapReadyCallback) as a parameter to `getMapAsync()`. Move your code that starts using the `GoogleMap` into `onMapReady()` of the `OnMapReadyCallback`. – CommonsWare Jul 09 '16 at 14:18
  • why appears public on read line ? – MenjeHer Jul 09 '16 at 15:33