Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:07:51+00:00 2026-06-15T13:07:51+00:00

I am looking at using ActionbarSherlock but have one query that’s holding me back.

  • 0

I am looking at using ActionbarSherlock but have one query that’s holding me back.

So my application needs to be fully backwards compatible to API Level 7.

I need to implement the new Google Maps in my application and to do that I need to use the SupportMapFragment class.

** My Question **

Is it possible to use the SupportMapFragment class alongside ActionBarSherlock?

Thanks in advance

EDIT

I have downloaded and had a look at the library. The only changes to the extended Fragments I can see are very simple and the same for all of them.

Do you think I could add support myself?

here is how they are supported.

package com.actionbarsherlock.app;

import android.app.Activity;
import android.support.v4.app.DialogFragment;
import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;

import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;

public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
    private SherlockFragmentActivity mActivity;

public SherlockFragmentActivity getSherlockActivity() {
    return mActivity;
}

@Override
public void onAttach(Activity activity) {
    if (!(activity instanceof SherlockFragmentActivity)) {
        throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
    }
    mActivity = (SherlockFragmentActivity)activity;

    super.onAttach(activity);
}

@Override
public void onDetach() {
    mActivity = null;
    super.onDetach();
}

@Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
    onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    //Nothing to see here.
}

@Override
public final void onPrepareOptionsMenu(android.view.Menu menu) {
    onPrepareOptionsMenu(new MenuWrapper(menu));
}

@Override
public void onPrepareOptionsMenu(Menu menu) {
    //Nothing to see here.
}

@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
    return onOptionsItemSelected(new MenuItemWrapper(item));
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    //Nothing to see here.
    return false;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:07:52+00:00Added an answer on June 15, 2026 at 1:07 pm

    It all works like a charm, mainly thanks to Jake’s great work on ActionBarSherlock

    Here are the steps I followed:

    1. Create a SherlockMapFragment class in your actiobarsherlock library project. I simply made a copy of SherlockFragment because I also needed support for setHasOptionsMenu(true)
    2. The activity extends SherlockFragmentActivity (as usual)
    3. The fragment extends the newly created SherlockMapFragment
    4. ActionBarSherlock requires the new google-play-services_lib library
    5. Your project requires the ActionBarSherlock library. No need to include the google-play-services again, or to build against Google API.
    6. As mentionned by Graham, you have to drop support for API 7 devices: <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />

    And here’s some code for a more detailed explanation:

    SherlockMapFragment

    package com.actionbarsherlock.app;
    
    import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
    import com.actionbarsherlock.internal.view.menu.MenuWrapper;
    import com.actionbarsherlock.view.Menu;
    import com.actionbarsherlock.view.MenuInflater;
    import com.actionbarsherlock.view.MenuItem;
    import com.google.android.gms.maps.SupportMapFragment;
    
    import android.app.Activity;
    import android.support.v4.app.Watson.OnCreateOptionsMenuListener;
    import android.support.v4.app.Watson.OnOptionsItemSelectedListener;
    import android.support.v4.app.Watson.OnPrepareOptionsMenuListener;
    
    public class SherlockMapFragment extends SupportMapFragment
            implements OnCreateOptionsMenuListener,
            OnPrepareOptionsMenuListener,
            OnOptionsItemSelectedListener {
        private SherlockFragmentActivity mActivity;
    
        public SherlockFragmentActivity getSherlockActivity() {
            return mActivity;
        }
    
        @Override
        public void onAttach(Activity activity) {
            if (!(activity instanceof SherlockFragmentActivity)) {
                throw new IllegalStateException(getClass().getSimpleName()
                        + " must be attached to a SherlockFragmentActivity.");
            }
            mActivity = (SherlockFragmentActivity) activity;
    
            super.onAttach(activity);
        }
    
        @Override
        public void onDetach() {
            mActivity = null;
            super.onDetach();
        }
    
        @Override
        public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
            onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
        }
    
        @Override
        public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
            // Nothing to see here.
        }
    
        @Override
        public final void onPrepareOptionsMenu(android.view.Menu menu) {
            onPrepareOptionsMenu(new MenuWrapper(menu));
        }
    
        @Override
        public void onPrepareOptionsMenu(Menu menu) {
            // Nothing to see here.
        }
    
        @Override
        public final boolean onOptionsItemSelected(android.view.MenuItem item) {
            return onOptionsItemSelected(new MenuItemWrapper(item));
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Nothing to see here.
            return false;
        }
    }
    

    The activity:

    public class MainActivity extends SherlockFragmentActivity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    }
    

    The activity XML layout:

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >
    
        <fragment
            android:id="@+id/fragment_map"
            android:name=".ui.fragments.MapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:tag="tag_fragment_map" />
    
        <fragment
            android:id="@+id/fragment_help"
            android:name=".ui.fragments.HelpFragment"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:tag="tag_fragment_help" />
    </FrameLayout>
    

    The map fragment:

    public class MapFragment extends SherlockMapFragment {
        private GoogleMap mMap;
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View root = super.onCreateView(inflater, container, savedInstanceState);
            mMap = getMap();
            return root;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at using ASP.NET MVC for a current project but I have some
I'm looking at using doctrine for an application I'm working on - but after
I've been looking at using session_regenerate_id in a login class which I have been
I'm looking at using Silverlight to create a multi-file uploader for one of our
I've been looking into using the UIPageControl for a scrolling part of an application,
I've been looking at using ExtJS Direct with ASP.NET MVC but it doesn't seem
I am looking into using only a ddl to run my query, not a
I am looking at using phonegap to create a mobile app that accesses a
I'm looking into using Assembla for hosted SVN, is it possible to have the
I am looking into using a wiki (prefer mediawiki, but not a req.) as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.