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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:17:23+00:00 2026-05-30T05:17:23+00:00

I use TexturePacker. I packed my textures and I have this file: sample.png sample.tps

  • 0

I use TexturePacker. I packed my textures and I have this file:

  • sample.png
  • sample.tps
  • sample.xml
  • sample.java

These resources are assets/gfx/sample. I connected to project sample.java.
I have this code:

Textures.java

public class Textures {

private ITexture mSpritesheetTexture;
private TexturePackTextureRegionLibrary mSpritesheetTexturePackTextureRegionLibrary;
private TextureRegion faceTextureRegion;
private TexturePack spritesheetTexturePack;

public Textures(final BaseGameActivity activity, final Engine engine) {
    try {
        BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
        this.spritesheetTexturePack = new TexturePackLoader(activity, "sample/").loadFromAsset(activity, "faces.xml");
        this.mSpritesheetTexture = spritesheetTexturePack.getTexture();
        this.mSpritesheetTexturePackTextureRegionLibrary = spritesheetTexturePack.getTexturePackTextureRegionLibrary();
        this.faceTextureRegion = this.mSpritesheetTexturePackTextureRegionLibrary.get(faces.FACES_ID);

        engine.getTextureManager().loadTexture(this.mSpritesheetTexture);
    } catch (final TexturePackParseException e) {
        Log.e("Error", String.valueOf(e));
    }
}

public TextureRegion getT(){
    return faceTextureRegion;
}

}

Main.java

...
Textures textures;
...
@Override
public void onLoadResources() {
    textures = new Textures(this, getEngine());
}

Define sprite and I get an error on this line:

final Sprite spriteS = new Sprite(50, 50, textures.getT());  

E/AndroidRuntime(391): Caused by: java.lang.NullPointerException
E/AndroidRuntime(391): at com.web.scene.AboutScene.<init>(AboutScene.java:24)

What is my mistake?

  • 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-05-30T05:17:24+00:00Added an answer on May 30, 2026 at 5:17 am

    I assume that the problem is that you try to initialize the Sprite spriteS before onLoadResources() is executed.

    Something like this may help you:

    Textures textures;
    Sprite spriteS;
    ...
    @Override
    public void onLoadResources() {
        textures = new Textures(this, getEngine());
        spriteS = new Sprite(50, 50, textures.getT());  
    }
    

    You might also move the sprite init to the method where the scene is created.

    P.S. It is only example code. It is not meant to provide clean or good style.

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

Sidebar

Related Questions

I use Texture Packer. I have .pvr.ccz file there are 10 frames. I need
Use case: 3rd party application wants to programatically monitor a text file being generated
use this website a lot but first time posting. My program creates a number
Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is
Use Elixir and have two entities -- Voter and Candidate -- with many to
use javascript or other method ? have any recommendation?
use warnings; use Test::More; use File::Find::Rule; use Test::File::Find::Rule; my $rule = File::Find::Rule->file->name('*.pl')->not_grep(qr/^\s*use\s+strict;/m, sub {
Use case: You have 2-3 files displayed in your MacVim window(s). You press ctrl+Q
use strict; use Time::HiRes qw[gettimeofday tv_interval]; my $start_index = int(rand(50))+100;#this value is arbitrary for
I'm trying to use the GLES1 version of the texturepacker extension. It refers to

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.