Displaying logo for few seconds at application start

后端 未结 7 1261
粉色の甜心
粉色の甜心 2021-02-08 07:13

I want to display a logo for few seconds before application starts and menu is visible. I want also to use some when it disappears. Should I create a new activity? Can I set it

7条回答
  •  无人共我
    2021-02-08 07:41

    package com.karan.android.video;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    
    public class splash extends Activity 
    {
    
       @Override
       public void onCreate(Bundle savedInstanceState) 
       {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.splash);
          Thread splashThread = new Thread() 
          {
             @Override
             public void run() 
             {
                try {
                   int waited = 0;
                   while (waited < 3000)
                   {
                      sleep(100);
                      waited += 100;
                   }
                } catch (InterruptedException e)
                {
                   // do nothing
                } finally 
                {
                   finish();
                   Intent i = new Intent(splash.this,video.class);
                   startActivity(i);
                }
             }
          };
          splashThread.start();
       }
    }
    
    Xml file:
    
    
    
    
         
          
    
         
    
    
    
    

提交回复
热议问题