I am getting an error creating a MapView with a layout file.  The app
has two activities with different layout files.  The main activity
launched from Home is not a MapAcitivity.  It starts the second
activity (MapActivity).  The error occurs in onCreate() for the first
Activity in setContentView(R.layout.main).  The error message is

"MapViews can only be created inside instances of MapActivity"

which makes sense except main.xml does not have a MapView element.
The intention was to to call setContentView(R.layout.mymapview) in the
MapActivity. But the MapView is being created with the context of the
main (non-map) Activity instead.

I have a workaround (directly instantiating the MapView without a
layout file) but just wondering if there is a way to control when the
layout file Views are created.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to