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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:41:20+00:00 2026-05-23T10:41:20+00:00

I have a simple activity that just shows two buttons, and I would like

  • 0

I have a simple activity that just shows two buttons, and I would like to load another activity as soon as that one is finished loading.

@Override
public void onCreate(Bundle savedInstanceState) {
    dbg("starting on create");
    super.onCreate(savedInstanceState);

    dbg("stting content view");
    setContentView(R.layout.main);

    createDrPopup();

}

private void createDrPopup(){
    dbg( "created new activity");
    startActivityForResult(new Intent(this, DrPopup.class), 
                           DR_POPUP_ACTIVITY_ID);
}

I don’t get any errors with this code, but the new activity doesn’t load properly. This way I only get a blanc screen.

But if I call the new activity with a delay, then everything works fine.

@Override
public void onCreate(Bundle savedInstanceState) {
    dbg("starting on create");
    super.onCreate(savedInstanceState);

    dbg("stting content view");
    setContentView(R.layout.main);

    Thread splashTread = new Thread() {
        @Override
        public void run() {
            try {
                sleep(500);
            } catch(InterruptedException e) {
            } finally {
                createDrPopup();
            }
        }
    };
    splashTread.start();
}

private void createDrPopup(){
    dbg( "created new activity");
    startActivityForResult(new Intent(this, DrPopup.class), 
                           DR_POPUP_ACTIVITY_ID);
}

my question is this:

Is there any better way to wait for an activity to finish loading. I can’t even be sure that 500ms will be enough each time.

Thank you for any suggestions.

requested code for dr_popup (this is as simple as it gets)

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    dbg("Created new activity");

    setContentView(R.layout.dr_webview);
    dbg("web view created");

}

and both layouts

main

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Spinner android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:id="@+id/spinner1"></Spinner>
</LinearLayout>

popup

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dr_popup_webview_layout" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:orientation="vertical">
    <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dr_popup_webview" android:layout_width="fill_parent"  android:layout_height="100dip"/>
    <LinearLayout  android:id="@+id/frameLayout1" android:layout_height="100dip" android:layout_width="fill_parent" android:orientation="horizontal">
        <EditText android:id="@+id/dr_submit_text"          android:layout_height="wrap_content"            android:layout_width="wrap_content"         android:layout_weight="4">
            <requestFocus></requestFocus>
        </EditText>
        <Button             android:text="Button"           android:id="@+id/dr_submit_button"          android:layout_height="wrap_content" android:layout_width="wrap_content"    android:layout_weight="1"></Button>
    </LinearLayout>
</LinearLayout>

edit: the problem seems to be caused by the manifest line @android:style/Theme.Dialog

    <activity android:theme="@android:style/Theme.Dialog"
              android:name=".DrPopup"
              android:label="@string/dr_popup">
    </activity>

If I remove that, things seem to work, but I would like a solution that would work even with that line.

and a picture that shows the problem. https://i.stack.imgur.com/6hhge.png

  • 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-23T10:41:21+00:00Added an answer on May 23, 2026 at 10:41 am

    I don’t see any reason from the provided code why do you have to insert a 500 ms delay… That’s just a non-sense to insert that delay.
    Some clarifications are needed:
    1. Did you do heavy processing within the original activity?
    2. startActivityForResult is called with purpose (since your code fragments doesn’t show any onActivityResult implementation)?

    I will try to implement a minimal example and update the post asap…

    −− Update

    After several attempts to understand and fix this issue with a parallel chat session, I reproduced the problem on a fresh 1.5 emulator.
    The problem finaly comes from the use of android:theme=”@android:style/Theme.Dialog” for the callee activity. The issue is observed on android 1.5 (both device and emulator). Whatever is declared in the second layout, whenever the associated activity is started, nothing is displayed. The display is just blank and a push on the back button initiates a transient display of the activity but go to the first activity (later part is nominal). I could not explain why this happens and I suggest to zidarsk8 to give PopupWindow a try or define a custom style (trial/error approach based on android Theme.Dialog source definition).

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

Sidebar

Related Questions

This seems like a simple problem: I have a WF4 activity that guides the
Ok I have a simple main activity that just presents the user with a
So I have a very simple android activity that starts a timer when you
I have a large activity that contains 100 or more buttons. But it's working
Im kinda stuck. I have an activity in my app that just wont go
I have a simple Activity that uses a android:theme=@android:style/Theme.Dialog in the manifest. My activity
friends, i have a EditText on simple activity with a button. when every i
I have simple win service, that executes few tasks periodically. How should I pass
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script

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.