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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:55:38+00:00 2026-06-15T12:55:38+00:00

what is the best way? 1) make a method: Assets.loadAll() that load all the

  • 0

what is the best way?

1) make a method:

Assets.loadAll()

that load all the texture used in the game, and call this method in the splashScreen (so only one time in all the activity life)

OR

2) make one method for each screen (ie. Assets.loadMainMenu, Assets.loadGameScreen, etc..) and call it in the show() of any screen? (and in the hide() call the Assets.disposeMainMenuAssets, Assets.disposeGameScreenAssets, etc etc..)

NOTE: the 2) is slower than the first but in in the first if i block the phone (with classical phisical button) and after go back to the app, the texture disappear (it doesn’t happen if i press the ‘home’ button… but if i lock the phone yes…. and the strange thing is that in libGdx 9.6 if i lock the phone the textures don’t disappear, but with libGdx 9.7 this append..)

  • 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-15T12:55:39+00:00Added an answer on June 15, 2026 at 12:55 pm

    If it’s 5MB’s of assets I say just load them on the splash screen. That way there will be little to no “load” time between screen switching. Method 1 is the best for this.

    Create a class called Assets. In this have a static method called “load”, like so

    public class Assets {

    private static Texture tex;
    public static TextureRegion tree,cloud1,cloud2,cloud3,rock,platform,playerStanding,
                                rocket, rocketShadow, moon, star;
    public static SpriteAnimation playerMoving;
    
    public static void load(){
        tex = new Texture(Gdx.files.internal("data/Graphics.png"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
        tree = new TextureRegion(tex, 0,0,246,226);
        cloud1 = new TextureRegion(tex, 246,0,225,92);
        cloud2 = new TextureRegion(tex, 358,197,88,84);
        cloud3 = new TextureRegion(tex, 0,226,105,64);
        rock = new TextureRegion(tex, 246,197,112,90);
        platform = new TextureRegion(tex, 246,92,193,105);
    
        tex = new Texture(Gdx.files.internal("data/Graphics2.png"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
        playerMoving = new SpriteAnimation(new TextureRegion(tex,0,0,458,555), 4, 5, 0.01f);
        playerStanding = new TextureRegion(tex,0,0,112,110);
    
        tex = new Texture(Gdx.files.internal("data/Graphics3.png"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
        rocket = new TextureRegion(tex,0,218,119,201);
        rocketShadow = new TextureRegion(tex,0,0,138,218);
    
        tex = new Texture(Gdx.files.internal("data/Graphics4.png"));
        tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
        moon = new TextureRegion(tex,0,0,410,382);
        star = new TextureRegion(tex,0,382,123,123);
    }
    
    public static void dispose(){
        tex.dispose();
    }
    }
    

    (This is just an example from my game. The names aren’t important, just the methods)

    On your splash screen you can just call Assets.load(); and all your assets will be loaded!

    Then you want to use an asset you can just make a call to it via Assets.whatever (which being static is fine)

    Hope this helps!

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

Sidebar

Related Questions

What is the best way to make sure that all the environment variables I
What's the best way to make a function that has pointer as argument work
What's the best way to do this, and how do you make it browser-proof?
What's the best way to make a synchronous version of an asynchronous method in
What is the best way to make the size of box 2 equal to
what's the best way to make communications between page widgets residing on differents ViewPart?
What is the best way to make an HTTP GET request in Ruby with
What is the best way to make my Qt Ruby application into an executable
I'm wondering what is the best way to make data thread-safe. Specifically, I need
I am wondering whats the best way to programmatically make rounded corners for images.

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.