3

I want to make an android application that uses Google Maps for Android v2.

I can show a map. I can even navigate and zoom. But, when I want to search for more operations to make, I can't find any.

I want this application to work on API level 8 and above. So, I used SupportMapFragment. I heard that, if I want to make my application to work on API level 8 and above, I have to use SupporMapFragment.

I found examples about MapFragments, but unfortunately, not about SupportMapFragment.

I want to make these operations work in my application, however, they're using MapFragment:

One

Two

Is there a way of doing things like, "add marker", "show my current location", and "take position of the point that I clicked"? (using SupportMapFragment, of course. )

Thank you very much already.

1 Answers1

5

Is there a way of doing things like, "add marker", "show my current location", and "take position of the point that I clicked"? (using SupportMapFragment, of course. )

Yes.

Step #1: Add the Android Support package to your app.

Step #2: Have your activities inherit from FragmentActivity from the Android Support package.

Step #3: Change all MapFragment references (Java code and layout XML resources) to SupportMapFragment.

And you're done.

All of my Maps V2 samples use SupportMapFragment, in conjunction with ActionBarSherlock (which is why you will see SherlockFragmentActivity as opposed to FragmentActivity.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491