Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. import android.app.Activity;
  2. import android.graphics.PixelFormat;
  3. import android.os.Bundle;
  4. import android.view.Window;
  5. import android.view.animation.Animation;
  6. import android.view.animation.AnimationUtils;
  7. import android.widget.ImageView;
  8. import android.widget.LinearLayout;
  9.  
  10.  
  11.  
  12. public class SplashScreenActivity extends Activity {
  13. public void onAttachedToWindow() {
  14. super.onAttachedToWindow();
  15. Window window = getWindow();
  16. window.setFormat(PixelFormat.RGBA_8888);
  17.  
  18.  
  19. }
  20. /** Called when the activity is first created. */
  21. @Override
  22. public void onCreate(Bundle savedInstanceState) {
  23. super.onCreate(savedInstanceState);
  24. setContentView(R.layout.main);
  25. StartAnimations();
  26. }
  27. private void StartAnimations() {
  28. Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
  29. anim.reset();
  30. LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
  31. l.clearAnimation();
  32. l.startAnimation(anim);
  33.  
  34. anim = AnimationUtils.loadAnimation(this, R.anim.translate);
  35. anim.reset();
  36. ImageView iv = (ImageView) findViewById(R.id.logo);
  37. iv.clearAnimation();
  38. iv.startAnimation(anim);
  39.  
  40. }
  41. }
  42.  
  43. Handler handler = new Handler();
  44. handler.postDelayed(new Runnable(){
  45. @Override
  46. public void run() {
  47. Intent intent = new Intent(MainActivity.class, this); //assuming your main ctivity is called that
  48. startActivity(intent);
  49. SplashScreenActivity.this.finish();
  50.  
  51. }, 3000); //assuming you want for the splashscreen to be displayed for 3 seconds.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement