Alper Tekin
Alper Tekin

Reputation: 173

How to use Android Google Map V2 as a fragment in Sliding menu?

I am using sliding menu with ActionBarSherlock and need to show android google map v2 in a fragment. The class extends SherlockFragment. What should I do?

Upvotes: 2

Views: 1931

Answers (2)

Alper Tekin
Alper Tekin

Reputation: 173

I have solved my problem at https://stackoverflow.com/a/14768343/1276967 It works with SherlockFragment but having inflating problems rarely. Maybe because of other issues..

Upvotes: 0

Serj Lotutovici
Serj Lotutovici

Reputation: 4380

The best way will be to extend SupportMapFragment and do all you logic there.

Then you can simply add this fragment in a ViewPager using FragmentPagerAdapter with a dataset of:

class FrgInfo {
    Class clss;
    Bundle args;
}

and overriding the getItem method:

@Override
public Fragment getItem(final int position) {
    final FrgInfo info = fragments.get(position);
    return Fragment.instantiate(context, info.clss.getName(), info.args);
}

This should do the trick.

Upvotes: 1

Related Questions