ActionBarCompat and MapActivity
Asked Answered
M

1

0

I've successfully converted most of my app to use ActionBarCompat by extending ActionBarActivity on most activities, however... I have a MapActivity class and need this to work here as well.

How would I go about creating a new class based on ActionBarActivity and having it extend MapActivity and would that even work?

The sample that Google provides in the ../samples/android-17/ActionBarCompat directory has a lot of these java files (ActionBarActivity.java, etc.) but also tons of required layouts, styles, drawables, etc., etc. and I wasn't sure if adding all of those files to my project is the only way to get this one map screen to work. Seems like there has to be a better way right?

Mensuration answered 31/7, 2013 at 20:37 Comment(0)
V
2

You can't create an activity that inherits from both. You'll have to create a MapFragment.

Vinnie answered 31/7, 2013 at 20:41 Comment(4)
This looks like a viable option, will investigate what it'll take to convert what I have to this. I was originally thinking more on the lines of: myMapActivity extends MyActionBarActivity. MyActionBarActivity would extend MapActivity (similar to how the original google ActionBarActivity extends Activity). Seems google would have created an ActionBarMapActivity in their library to solve this for both Activity types.Mensuration
I think the fact that there is no ActionBarMapActivity was very intentional.Vinnie
I also see a SupportMapFragment, will try that since I'm trying to support 2.x users as well.Mensuration
To elaborate, the old v1 map activity doesn't support maps as fragments. The original MapView API is in the process of being deprecated in favor of the v2 maps linked above. The main requirement for this is the Google Play Services library, which is backwards compatible to i believe 2.3. developer.android.com/google/play-services/setup.htmlDefoliate

© 2022 - 2024 — McMap. All rights reserved.