Sunday 26 June 2016

Make Splash Screen with Animation Android Application


https://dedyyuristiawan.blogspot.com


Hello world. Today i wanna show how to create slash screen with animation in android apps. In this post i am use small to big to small animation, you can see in demo apps. I am using last android studio and lollipop minimum sdk. lest do this.

First important thing if you want to make splash screen is logo, this is important for you and make your logo to png file, cause it can be our android apps runs fast. Splash screen its a activity so we make first activity for splash screen. This is important code in screen activity.

new Handler().postDelayed(new Runnable() {
 @Override
    public void run() {
        Intent i = new Intent(SplashScreen.this, MainActivity.class);
        startActivity(i);
        finish();
    }
}, SPLASH_TIME_OUT);

So the purpose for this function is before we move to another activity (main activity class), the screen activity will hold until splash_time_out done. splash_time_out is integer variable. In this case i set 3000 it mean 3 second. Yup its purpose we make hander in splash screen activity.

Whats about xml layout? in xml layout i just put image and text, and image and text i will make animation. Actually this layout is similar with another layout, you can see in the my demo code.

The second thing i wanna make animation in the splash screen. So this is my important code in splash screen activity.

protected void onResume() {
    super.onResume();
    logo_holder.startAnimation(anim_logo);
    Handler handler = new Handler();
 Runnable startMain = new Runnable() {
  @Override
  public void run() {
   if (!isFinishing()){
    text_holder.startAnimation(anim_txt);
   }
  }
 };
 handler.postDelayed(startMain, 200);    
}

 The purpose onResume function is make logo_holder to start animation (anim_logo is code xml i put in the anim folder on res) and then after image done for the animation, text will be show after image done, see in condition (if finishing). 

You can download my source code bellow, after this you can see my code and understand it, if you still confuse about code, you can write comment bellow. Thanks.

Source Code Github
Share:
Lokasi: Semarang, Semarang City, Central Java, Indonesia

5 comments:

  1. Thanks for sharing this useful article about animation android application. So, Browse help me write my essay to know that how to enlarge view with a touch-to-zoom animation.

    ReplyDelete
  2. Really interesting content and thanks for sharing with us. Mobile app development playing an crucial part in various industries like software development companies, product engineering services companies, etc. Keep sharing more informative content with us.

    ReplyDelete
  3. At Artoon Solutions, we offer top-notch Android app development services in India that are both competent and cost-effective. Our rates are highly competitive compared to other IT companies in India, which means you can get the best value for your investment.

    ReplyDelete


<br>


Advice for contacting me at dedyy54@gmail.com