Question

Possible Duplicate:
Android SplashScreen

I am new to android application development.

I developed one android application using android sdk. i install .apk file in samsung tab,and it is working properly.

But my requirement is before my application home page launching i have to display my company logo in one screen and my application title in another screen each 5sec after that my application home page have to display automatically.

please help me go forward.

Was it helpful?

Solution

       startTime = System.currentTimeMillis();


     TimerTask enableTask = new TimerTask() {
     public void run() {
             handler.post(new Runnable() {
                     public void run() {
                      currenttime = System.currentTimeMillis();
             if(currenttime-startTime > 30000) {

             Intent intent = new Intent(Activity.this,
                    nextActivity.class);

            startActivity(intent);
             }
             else {

              go.setVisibility(View.GONE);
             }
                     }
            });
     }};

  Timer t = new Timer();
  t.schedule(enableTask,1000, 30000);

OTHER TIPS

use Thread.sleep() in Asynck Task as:

private class splashAsync extends AsyncTask<Void, Void, Void>
{
        protected void onPreExecute(){

        }     
        protected Void doInBackground(Void... params) {
        try { 
            Thread.sleep(1000);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
        }
        protected void onPostExecute(Void v){
        startActivity(new Intent(Activity1.this,Activity2.class));
        finish();
        }
      }

Use a timer. Start Timer which runs for a specific period. Say 5 seconds. When the timer finishes , close your first activity which displays company logo and start the second activity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top