0

I want the application to run on the version of Android - 8

I found some "answers", but still receives on a NullPointerException.

        try {   
            FragmentManager myFM = ActivityMapa.this.getSupportFragmentManager();

            final SupportMapFragment myMAPF = (SupportMapFragment) myFM.findFragmentById(R.id.mapa);
            map = myMAPF.getMap();
        } catch (Exception e) {
            Log.d("mapa", "FR error: " + e);
            map = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapa)).getMap();
        }

second answer:

// in try()
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapa)).getMap();

The code is in:

public class ActivityMap extends ActivityOptions {  // ActivityOptions extends FragmentActivity

    (...)
    protected void onCreate() {

        // try()

    }


}

What to do to not get an exception?

Gimer
  • 13
  • 5
  • Kindly to go this: [http://stackoverflow.com/questions/21475489/android-google-map](http://stackoverflow.com/questions/21475489/android-google-map) – M D Mar 04 '14 at 10:29
  • Thank You! I have not changed android: name = "com.google.android.gms.maps.SupportMapFragment" in xml. Where can I select the solution thread? – Gimer Mar 04 '14 at 10:40
  • Working on the device – Gimer Mar 04 '14 at 10:44
  • We did not understand a. App already running, previously missing only the changes in xml file: MapFragment -> SupportMapFragment. Thank you for your help! :) – Gimer Mar 04 '14 at 10:50
  • How to I noted in a post that is solved? – Gimer Mar 04 '14 at 10:53
  • Yes, in post, but where is option "accept the answer" in comments? – Gimer Mar 04 '14 at 10:56
  • not in comment it is available only in Answer – M D Mar 04 '14 at 10:57

0 Answers0