Android Question Google Maps with ActionBar

GaryK4

Member
Licensed User
Longtime User
I am pulling my hair out and cannot afford it.
I have Google maps and GoogleMapsExtras working. Now I want to display the map in an action bar tab.
When I do this, I get an error.
java.lang.IllegalArgumentException: No view found for id 0x2711 (unknown) for fragment MapFragment{4443c5d #0 id=0x2711}
The Sub MapFragment1_Ready never triggers.

Activity.LoadLayout("mapview") <-- works

This does not find the mapfragment.
vp.Initialize("vp", 6, 100%x, height)
Activity.AddView(vp.AsView, 0, 0, 100%x, height)
vp.Panels(3).LoadLayout("mapview")
How do I get this to work?

Maps & Extras V2.0
StdActionBar V1.52
 

GaryK4

Member
Licensed User
Longtime User
Don't use StdActionBar.
Use TabStripViewPager instead.

Does it work?

It works!

The Good:
Easier to use.​

The Bad:
You lose height or a row. The tabs used to be on the main activity first line with the activity title.
Now the tabs appear below the title line.
I need to do some rearranging, but this should work for me.

Thanks.


Update:
I have a very long program and as I added the code into it, it began to fail.
I suspect it is some kind of timing issue. If I use the StdActionBar and make the map the first tab, it works. If I make it the last tab, if fails to find the map Fragment.
When using TabStripViewPager, I set the last tab at the end of Activity_Create and had to put a small Sleep(20) before it.

I am staying with the StdActionBar because I can put the tabs on the Activity line and don't lose a row. I don't know how or if it is possible to add TabStripViewPager tabs on the title line.

In any event, it looks like it is working very well!
 
Last edited:
Upvote 0

Sapta

Member
Licensed User
Longtime User
I would like to share my experience with this error.
When I use the TabHosts and use the MapFragment inside, an error occurs when I put it in tab 2, when MapFragment I put into tab 1 this error does not exist.
Hope it helps. In conclusion, if you want to display MapFragment put on Tab 1, correct me if I'm wrong...
Thank's
 
Upvote 0
Top