Android : Access Mapview Inside Fragment With ViewPager

后端 未结 2 593
时光取名叫无心
时光取名叫无心 2020-12-18 09:31

I am Using View Pager to Display three Views.

\"Filter\",\"Streets\",\"Around\"

Each View is Defined by Fragment.

WHAT I WA

2条回答
  •  忘掉有多难
    2020-12-18 10:14

    To use Google Maps, you have to extend MapActivity, which you didn't do. Check out this example in the docs. In the spirit of maintainability, I wouldn't resort to solutions that use deprecated functionality.

    A more solid solution is to extend MapActivity and copy the missing implementation from FragmentActivity. If you don't want or need backwards compatiblity with older Android versions, just use MapActivity rather than FragmentActivity, which should already include the functionality needed to show Fragments in Android 3.0 and later.


    Edit: here's a project that did it for you.

提交回复
热议问题