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

The Archive Base Latest Questions

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

My code looks as follows.. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try

  • 0

My code looks as follows..

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    try {
        Thread.sleep(3000);
        } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
     finish();
    }

And my XML is

<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_gravity="center"><Button android:id="@+id/Button01" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Button"
    android:layout_gravity="center"
    android:layout_marginTop="80px"></Button>

In my XML i had a button. Now what i want is After starting the activity i have to wait for 3 seconds and then the Activity has to be stopped..Through my code the Activity is stopped after 3 seconds. But am not seeing any Button when the activity is started..Only Black screen is appearing for 3 seconds..But i also want to display that button..can any one help with sample code..please…I am need of it..

  • 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-17T02:19:31+00:00Added an answer on May 17, 2026 at 2:19 am

    That’s because you’re sleeping in the onCreate, which means it’s holding up in the UI thread before actually rendering the screen (which happens after onCreate finishes running). You’ll really want to do the sleeping in a separate thread, either with a standard Java Thread/Runnable or an AsyncTask, to prevent users getting an Application Not Responding (ANR) dialog, too. There’s a very good Android Developers Blog post about threading on Android that I highly recommend reading if you’re at all confused about how threading works in Android activities, especially if you’re used to server or other non-UI Java coding.

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

Sidebar

Related Questions

I am using Tomcat 6 and Postgresql 8.4. My code looks as follows: try
My code looks something like: template <typename type> void deserialize_element(type* result) { //... if
The basic pseudo code looks like this: void myFunction() { int size = 10;
I'd like to make 2 selections inside container (Container). The code looks as follows:
My code looks like this : Vector<String> My_Vector=new Vector<String>(); String My_Array[]=new String[100]; for (int
My code looks like this: NSIndexPath *ip = [NSIndexPath indexPathForRow:15 inSection:0]; [[self tableView] selectRowAtIndexPath:ip
My code looks like: Entity e = new Entity(); e.name = ...; e.blah =
here is what my code looks like i have two forms: class Form_1 extends
EDIT - The code looks strange here, so I suggest viewing the files directly
My C# code looks like this: myNum = dt.Columns[0]; myNum is an integer and

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.