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

  • Home
  • SEARCH
  • 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 8409089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:48:40+00:00 2026-06-09T23:48:40+00:00

Quick question: I’ve got this code: public EngineOptions onCreateEngineOptions() { instance = this; mCamera

  • 0

Quick question:
I’ve got this code:

public EngineOptions onCreateEngineOptions() {
    instance = this;

    mCamera = new org.andengine.engine.camera.Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
    engineOptions.getAudioOptions().setNeedsSound(true);
    //engineOptions.getAudioOptions().setNeedsMusic(true);


    return engineOptions;

}

And

protected void onCreateResources() {





    SoundFactory.setAssetBasePath("mfx/");



    try {
        this.testSound = SoundFactory.createSoundFromAsset(this.mEngine.getSoundManager(), this, "explosion.ogg");
    } catch (final IOException e) {
        Debug.e(e);
    }
}

And I finaly play it on another class that has this activity as a field :

    activity.mCurrentScene.registerTouchArea(image);
    activity.mCurrentScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea, float pTouchAreaLocalX,
                float pTouchAreaLocalY) {
            Zancudo.this.activity.testSound.play();
            return false;
        }
    });

Any ideas why am I getting a nullpointer exception ?

Thank you!

  • 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-09T23:48:42+00:00Added an answer on June 9, 2026 at 11:48 pm

    For play sound you are using like below

    Zancudo.this.activity.testSound.play();
    

    This looks like the issue because here the activity object is not instantiated in the Zancudo class.

    To access the testSound you need to get the instance of the Zancudo activity.

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

Sidebar

Related Questions

quick question on GWT from a newbie. Considering the following code: FlowPanel block =
Quick question about the TransactionScope object. Found this on the internet: When you access
Quick question: is this kind of nesting possible? An if statement first passing a
Quick question, having a look around it seems this is the case, but it
Quick question here about short-circuiting statements in C#. With an if statement like this:
quick question I'm struggling with, hopefully I've just got a brain-blockage and I'm missing
quick question. Is there any way to make this possible? int array [] =
Quick question, I found answers close to this but nothing that helps me. I
quick question: why wont this while-loop wait for input? (ing is a string) while(ing
Quick question: How do you set defaultvalue with asp? Here is my code: <SelectParameters>

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.