Can somebody give me a good example on how to use a MapView with the ActionBar in Android 4.0 ICS?
Isn't there something like a MapFragment or so?
I want my app to have view control in the actionbar (dropdownlist for navigation) and one of the fragments has to be a map
Google Maps API for Android v2 has MapFragment. It's documented in developers.google.com.
Related
I have an app having actionbar where one of the fragments contain a mapFragment. Also, i've to make an overlay of list on top of the map. MapFragment as of now as lesser functionality(i cant make setInfoWindowAdapter to work in it).So my question is should I be using Mapview within a fragment or MapFragment within in a fragment? which is the best practice?
I've read through many articles but none them exactly mention which is the best option and why.
Both are correct if done correct.
Fragments inside fragments are supported as of support library v11.
Two things to remember:
you cannot put MapFragment to xml
you have to use getChildFragmentManager
Check this link for how to correctly add MapFragment inside your fragment: http://code.google.com/p/gmaps-api-issues/issues/detail?id=5064#c1
I have a question . I'm trying to use MapView in Google Maps Android API v2 . I'm read in document . They said that
MapView, a subclass of the Android View class, allows you to place a map in an Android View. A View represents a rectangular region of the screen, and is a fundamental building block for Android applications and widgets. Much like a MapFragment, the MapView acts as a container for the Map, exposing core map functionality through the GoogleMap object.
It may be MapView and MapFragment are the same thing . In Google Maps Android API v1 , MapView extend MapActivity . But in Google Maps Android API v2 , I can use it any more . I see the tutorial
How do you display Google Maps via new Google Maps API v2 on Android?
They advice to extend FragmentActivity . But in my layout xml , I just use
<com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
It doesn't have prefix fragment like MapFragment . And when it displays , It looks like when I use MapFragment . May be both of them is the same thing ???? I'm not clear about that . Anyone can explain for me . Sorry my English is not good !!!
I want to display Map in one of my Fragment I am using 4 fragments in which one shows the map but i don't want to use LocalActivityManagerto host a Activity inside a fragment. It is a deprecated class, but it offers the simplest solution.
By using MapActivity it is starting a new Activity which i don't want i want to display it in viewpager and MapView dont work in Fragment.
Please suggest me how to get it.
Thanks for Help.
Since Maps V1 (MapActivity and kin) is deprecated, you could consider moving to the new Maps V2, which has MapFragment (for native API Level 11 fragments) and SupportMapFragment (for the Android Support Library's backport of fragments).
I found no other way then the one mentioned in the following way...
https://stackoverflow.com/a/8126287
I have a pretty simple question about the Android ActionBar... is this intended to be present in the app, to use as a sort of header, or is it only intended to show when the user hits the setting button on the device?
I'm trying to implement a menu that is always present in the app, like a logo for branding, and some other actions, like a search icon and perhaps a map icon to see the map functionality. Any suggestions? Also see this post here
The ActionBar is always displayed. Check out the Android Developer Site for more information on the ActionBar UI patterns and usage.
You can use the excellent ActionBarSherlock library to provide an ActionBar on 2.x devices.
The ActionBar sounds perfect for the branding/icons you want. You would use your logo as the icon, and then have Action Items for Search and Map functionality.
Have you put your android:targetSdkVersion to 11 or more ? ActionBar is available only for Honeycomb and ICS :)
Any idea how to implement tabs like these (the one on top with home image, star, etc)
Using tabs in an action bar on Ice Cream Sandwich.
Or ActionBarSherlock tabs for a full on backward compatibility.
Those are so-called "swipey tabs", probably on top of a ViewPager. ViewPagerIndicator has an implementation of such tabs.
if you wish to use the same tabs-pager like on the android market app (aka google play) , you can get the android support library from the sdk manager and see their sample on ".../extras/android/support/samples/Support4Demos" .
there , find the fragment example called "tabs and pager" . i think you will like it ... :)
Try this. The solution there is to use the setDividerDrawable(...) method of the TabWidget class. Then you can define the looks of the tabs with XML.