Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps in an actionbarsherlock tab
    primarykey
    data
    text
    <p>I am trying to get google maps v2 working in my app. I have seen several examples showing how you can open up SupportMapFragment inside an activity. The idea being that your activity will call <code>setContentView(R.layout.map_layout);</code> where map_layout.xml links to the fragment with the lines:</p> <pre><code>android:name="com.google.android.gms.maps.SupportMapFragment" xmlns:map="http://schemas.android.com/apk/res-auto" </code></pre> <p>The "name=" line effectively says that "this layout is to be controlled by a fragment of type 'SupportMapFragment'".</p> <p>My complication is that I am attempting to get the map to appear in an activity with tabs (implemented with actionbarsherlock). This means that whatever fragment corresponds to a tab selection must implement a TabListener. But SupportMapFragment doesn't. So now presumably I need to create a new fragment like so:</p> <pre><code>public class MyMapFragmentWithTabListener extends SupportMapFragment implements TabListener { </code></pre> <p>But now I have got all confused about how to write the contents of MapFragmentWithTabListener in particular onCreateView... should I be inflating some layout? Surely I can't be inflating exactly the same map_layout.xml from the examples because that already declares that it is controlled by SupportMapFragment, whereas in this implementation it should be controlled by MyMapFragmentWithTabListener - do I need a slightly different xml file to inflate (if so, what should it look like?) - or should I be creating my view programatically?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload