Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.app.Activity;
- import android.graphics.PixelFormat;
- import android.os.Bundle;
- import android.view.Window;
- import android.view.animation.Animation;
- import android.view.animation.AnimationUtils;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- public class SplashScreenActivity extends Activity {
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- Window window = getWindow();
- window.setFormat(PixelFormat.RGBA_8888);
- }
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- StartAnimations();
- }
- private void StartAnimations() {
- Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
- anim.reset();
- LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
- l.clearAnimation();
- l.startAnimation(anim);
- anim = AnimationUtils.loadAnimation(this, R.anim.translate);
- anim.reset();
- ImageView iv = (ImageView) findViewById(R.id.logo);
- iv.clearAnimation();
- iv.startAnimation(anim);
- }
- }
- Handler handler = new Handler();
- handler.postDelayed(new Runnable(){
- @Override
- public void run() {
- Intent intent = new Intent(MainActivity.class, this); //assuming your main ctivity is called that
- startActivity(intent);
- SplashScreenActivity.this.finish();
- }, 3000); //assuming you want for the splashscreen to be displayed for 3 seconds.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement