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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:02:29+00:00 2026-05-26T23:02:29+00:00

So there is this game im trying to create, and in the lessons activity

  • 0

So there is this game im trying to create, and in the lessons activity i have a nice scenic background. I want the player to see this for a sec or 2 before my tutorial popup xml inflates. The thing is the transparent popup xml and the background xml both appear as soon as the activity is initiated. Im new at this and cant understand the explanation in android developers homepage. Any help will be much appreciated.

package com.jibushi;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class LessonsShell extends Activity {

    private View view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.lessons);

        final ViewGroup parent = (ViewGroup) findViewById(R.id.lessons_bg);

        Thread splashTread = new Thread() {
            @Override
            public void run() {
                try {
                    wait(1000);
                } catch (InterruptedException e) {

                } finally {
                    view();
                }
            }

            private void view() {
                // TODO Auto-generated method stub
                view = LayoutInflater.from(getBaseContext()).inflate(
                        R.layout.lessons_dialog, null);
                parent.addView(view);
            }
        };
        splashTread.start();
    }
}
  • 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-26T23:02:30+00:00Added an answer on May 26, 2026 at 11:02 pm

    try this:

    public class LessonsShell extends Activity{
    private static final int MESSAGE_SHOW_POPUP=7;
    private static final long TIME_DELAY=3000;//3 seconds
    private View view;
    private Handler handler=new Handler(){
       handleMessage(Message msg){
          switch(msg.what){
            case MESSAGE_SHOW_POPUP:
               view();
               break;
           }
       };
    };
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    
    setContentView(R.layout.lessons);
    //this will send a message to the handler to display the popup after 3 seconds.
    handler.sendEmptyMessageDelayed(MESSAGE_SHOW_POPUP,TIME_DELAY);
    
    }
    
    private void view() {
    // TODO Auto-generated method stub
     ViewGroup parent = (ViewGroup) findViewById(R.id.lessons_bg);
     view = LayoutInflater.from(getBaseContext()).inflate(R.layout.lessons_dialog, null);
     parent.addView(view);
    }
    

    }

    A handler is an nice replacement for a timer in android.

    What you were previously doing was to create a background thread in onCreate, trying to access the UI thread from there. From my experience it should crash, since you cannot access the UI thread from a background thread.

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

Sidebar

Related Questions

I'm trying to create a game similar to this (Note:When you click 'play', there
I'm trying to create a game. I have a list. I want to take
I am trying to create my first game for android. I currently have a
In this game im trying to create, players are going to be able to
I'm trying to create a endlessly scrolling bitmap background. I want to make it
There's this Excel file I want users to be able to download from my
I am currently trying to create a menu system for a game and cannot
I'm trying to write a little CLI Hangman game, just to create something in
I'm trying to create a small and basic ajax based multiplayer game. Coordinates of
I am trying to create a scene graph for my 3D game in which

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.