MapView without MapActivity

I am writing this Android application in which I have many actions that extend the Activity class. I also need an operation that uses MapView to display the Map along with the ListView on the screen (similar to the list of rental houses where the houses are shown using the contacts on the map). Since I have a base class that extends the Activity class, all other actions extend this base class. Only the screen that has the map should extend the MapActivity class. When I try to do this, I threw an IllegalAccessError exception.

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

I made sure that I have an entry in the manifest.

Any help would be greatly appreciated.

+4
java android google-api android-mapview mapactivity
source share
2 answers
0
source share

I do not think that's possible. MapView will only work in MapActivity, and each MapActivity can contain only 1 MapView. I ran into similar problems when using the same Activity base class. Try moving part of the code from the base class to static methods or to a composite design pattern to reduce the amount of code copied. It should be possible to create code so that only onX methods need to be duplicated between the base action and your MapActivty.

+1
source share

All Articles