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 8735905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:10:40+00:00 2026-06-13T10:10:40+00:00

I’m a noob to Android development and i want to develop a game you

  • 0

I’m a noob to Android development and i want to develop a game you using AndEngine and use SherlockActionBar for navigation. The problem is that AndEngine requires me to extend SimpleBaseGameActivity and SherlockActionBar needs to extend SherlockActivity. I am attempting to use a nested class approach, but i can’t figure out how to make AndEngine initialize during OnCreate. Any help is greatly appreciated.

–EDIT–
I’ve tinkered with the static attachment demo in the ActionBarSherlock examples, but still can’t figure out how to make this work, since there is no OnCreate method in the existing AndEngine demo code.

public class WABActivity extends SimpleBaseGameActivity implements IOnMenuItemClickListener, OnCreateOptionsMenuListener {
ActionBarSherlock mSherlock = ActionBarSherlock.wrap(this);

private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;

protected static final int MENU_RESET = 0;
protected static final int MENU_QUIT = MENU_RESET + 1;

private Camera mCamera;

protected Scene mMainScene;

private BitmapTextureAtlas mBitmapTextureAtlas;
private ITextureRegion mFaceTextureRegion;

private Font mFont;

protected MenuScene mMenuScene;

@Override
public EngineOptions onCreateEngineOptions() {
    this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera);
}

@Override
public void onCreateResources() {
    FontFactory.setAssetBasePath("font/");

    final ITexture fontTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    this.mFont = FontFactory.createFromAsset(this.getFontManager(), fontTexture, this.getAssets(), "Plok.ttf", 48, true, android.graphics.Color.WHITE);
    this.mFont.load();

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 64, 64, TextureOptions.BILINEAR);
    this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box_menu.png", 0, 0);
    this.mBitmapTextureAtlas.load();

}

@Override
public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    this.mMenuScene = this.createMenuScene();

    /* Just a simple scene with an animated face flying around. */
    this.mMainScene = new Scene();
    this.mMainScene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    final Sprite face = new Sprite(0, 0, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
    face.registerEntityModifier(new MoveModifier(30, 0, CAMERA_WIDTH - face.getWidth(), 0, CAMERA_HEIGHT - face.getHeight()));
    this.mMainScene.attachChild(face);

    setTheme(R.style.Theme_Sherlock); //<--Not sure if this goes here
    mSherlock.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); //<--Not sure if this goes here
    mSherlock.setContentView(???); //<--How do I set ContentView? Do I need to set contentview?

    return this.mMainScene;
}

@Override
public boolean onKeyDown(final int pKeyCode, final KeyEvent pEvent) {
    if(pKeyCode == KeyEvent.KEYCODE_MENU && pEvent.getAction() == KeyEvent.ACTION_DOWN) {
        if(this.mMainScene.hasChildScene()) {
            /* Remove the menu and reset it. */
            this.mMenuScene.back();
        } else {
            /* Attach the menu. */
            this.mMainScene.setChildScene(this.mMenuScene, false, true, true);
        }
        return true;
    } else {
        return super.onKeyDown(pKeyCode, pEvent);
    }
}

@Override
public boolean onMenuItemClicked(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pMenuItemLocalX, final float pMenuItemLocalY) {
    switch(pMenuItem.getID()) {
        case MENU_RESET:
            /* Restart the animation. */
            this.mMainScene.reset();

            /* Remove the menu and reset it. */
            this.mMainScene.clearChildScene();
            this.mMenuScene.reset();
            return true;
        case MENU_QUIT:
            /* End Activity. */
            this.finish();
            return true;
        default:
            return false;
    }
}

protected MenuScene createMenuScene() {
    final MenuScene menuScene = new MenuScene(this.mCamera);

    final IMenuItem resetMenuItem = new ColorMenuItemDecorator(new TextMenuItem(MENU_RESET, this.mFont, "RESET", this.getVertexBufferObjectManager()), new Color(1,0,0), new Color(0,0,0));
    resetMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    menuScene.addMenuItem(resetMenuItem);

    final IMenuItem quitMenuItem = new ColorMenuItemDecorator(new TextMenuItem(MENU_QUIT, this.mFont, "QUIT", this.getVertexBufferObjectManager()), new Color(1,0,0), new Color(0,0,0));
    quitMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    menuScene.addMenuItem(quitMenuItem);

    menuScene.buildAnimations();

    menuScene.setBackgroundEnabled(false);

    menuScene.setOnMenuItemClickListener(this);
    return menuScene;
}

@Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
    return mSherlock.dispatchCreateOptionsMenu(menu);
}

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        sub = menu.addSubMenu("Options");
        sub.add(0, 1, 0, "Settings");
        sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);      
        return true;
    }

    @Override //<-- Giving Error: must override or implement a supertype method
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home || item.getItemId() == 0) {
            return false;
        }
        if(item.getItemId()==1){
            //SETTINGS SCREEN//
            sub.removeItem(1);
            sub.removeItem(2);
            sub.removeItem(3);
            sub.removeItem(4);
            sub.removeItem(5);
            sub.add(0, 5, 0, "Home");
            sub.add(0, 2, 0, "High Scores");
            sub.add(0, 3, 0, "Help");
            sub.add(0, 4, 0, "About");
            //mMode = startActionMode(new AnActionModeOfEpicProportions());
            }

        }


}
  • 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-13T10:10:41+00:00Added an answer on June 13, 2026 at 10:10 am

    Look at the static attachment example included in the ActionBarSherlock demo code.
    Static attachment exists exactly for this purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

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.