MapView without MapActivity
Asked Answered
A

2

4

I am writing this android application where in I have many activities that extend the Activity class. I also need an activity that uses MapView to show the Map along with a ListView in the screen (similar to rental house list where the houses are shown using pins on the map) Since I have a base class which extends the Activity class, all the other activities extend that base class. Only that particular screen which has the map needs to extend the MapActivity class. When I try doing that I am thrown a IllegalAccessError Exception.

Project setup - Android 2.1-update1 and GoogleAPI 2.1-update 1 both throw the same exception. The application is for a tablet.

I have made sure that I have the entry in the Manifest.

Any help would be much appreciated.

Ahvenanmaa answered 31/3, 2011 at 1:13 Comment(0)
A
0

Finally here comes the Google Maps API v2.

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment

They have heard us! :)

Ahvenanmaa answered 5/1, 2013 at 2:4 Comment(0)
O
1

I don't think there is any way around this. A MapView will only work in a MapActivity and each MapActivity can only contain 1 MapView. I have run into similar problems when using a single Activity base class. Try moving some of the code from your base class into either static methods or into a composite design pattern to cut down on the amount of copied code. It should be possible to design your code so that only the onX methods need to be duplicated between your base Activity and your MapActivty.

Ostracod answered 31/3, 2011 at 1:46 Comment(1)
Thanks for those inputs skorulis. I am heading in the direction you have suggested.Ahvenanmaa
A
0

Finally here comes the Google Maps API v2.

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment

They have heard us! :)

Ahvenanmaa answered 5/1, 2013 at 2:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.