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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:39:10+00:00 2026-05-27T17:39:10+00:00

At the moment I work on an android-phonegap project. Before the app loads the

  • 0

At the moment I work on an android-phonegap project.

Before the app loads the index.html there is some native code doing work. In detail it’s in AsyncTask which is knocking around on the SD card (if available).

I managed to show a progress bar while the A.Task is working but furthermore I’d like to add a Splash screen in the background. I mostly worked with Phonegap and just start with native code. So I’m kinda confused by all these layouts, themes and what else you may define in the .xml files. I’m pretty sure it’s also a good idea for bigger UI designs but for the simple Splash screen I want right now it feels like a total overkill.

This is a snippet from the source. Just straight forward. onCreate() calls the AsyncTask wich does some work and starts PhoneGap in it’s PostExecute method. I’d like the screen to appear either in the onCreate method or onPreExecute. After the job is done the screen I’d dismiss the screen in onPostExecute(). I also added comments to illustrate my idea.

public class myAct extends DroidGap {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //Show Splash here or in onPreExecute()!
        new myAsTa().execute();
    }
}


class myAsTa extends AsyncTask<Void, Integer, Boolean> {
    ProgressDialog dialog = new ProgressDialog(myAct.this);

    @Override
    protected void onPreExecute() {
        //or show splash here!
        dialog.setMessage("Cool Progressbar!");
        dialog.show();
        super.onPreExecute();
    }

    protected Boolean doInBackground(Void... values) {
            //magician at work!
            return true;
         }


        @Override
        protected void onProgressUpdate(Integer... values) {
            //insult user here
        }

        protected void onPostExecute(Boolean result) {
            dialog.dismiss();
            //dismiss splashscreen
            //start Phonegap
        }
    }

Thanks for reading and your help 🙂

  • 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-27T17:39:10+00:00Added an answer on May 27, 2026 at 5:39 pm

    I have done such a splash screen here. This loads the splash layout and is itself triggered directly from the system when the app is loaded (AndroidManifest.xml)

    <activity android:name=".SplashActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
     </activity>
    

    What is shown on screen is defined in setContentView(R.layout.splash); – this layout is basically

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:background="@drawable/desktop_rhq"
    
            >
    
        <TextView android:layout_gravity="bottom"
                  android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:layout_marginBottom="10dp"
                  android:text="@string/loading"
              />
    </LinearLayout>
    

    Which defines a background image and some text to be shown. To be honest, I haven’t thought much about orientation change while the splash is running – I guess this will restart the background task.

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

Sidebar

Related Questions

I am doing some screen scraping work at the moment using PHP and Simple
AFAIK there is absolutely no way to detect the moment when app gets uninstalled.
At the moment, I have to work with XACML . As there doesn't seem
I have a mobile web app (HTML & CSS). I use Phonegap to embed
I'm currently working on an app for the Android OS that displays some data.
I'm behind a firewall at work at the moment and I was testing something
I am working with legacy systems at the moment, and a lot of work
At the moment my code (PHP) has too many SQL queries in it. eg...
At the moment I am working on a project admin application in C# 3.5
I'm starting to work with Android, and as far as I have read, the

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.