package com.nsgk.ruralWeb; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.AnticipateInterpolator; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; public class WelcomeActivity extends AppCompatActivity { private ImageView imageView; private Handler handler = new Handler() { @SuppressLint("HandlerLeak") @Override public void handleMessage(@NonNull Message msg) { switch (msg.what) { case 1: finish(); Intent intent = new Intent(WelcomeActivity.this, FullscreenActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); overridePendingTransition(R.anim.activity_in, R.anim.activity_out); break; default: throw new IllegalStateException("Unexpected value: " + msg.what); } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_welcome); imageView = findViewById(R.id.imageView); Animation animation = AnimationUtils.loadAnimation(this, R.anim.img_anim); animation.start(); imageView.animate() .scaleXBy(1.5f) .scaleYBy(1.5f) .setInterpolator(new AnticipateInterpolator()) .setDuration(1300) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { handler.sendEmptyMessageDelayed(1, 1000); } }); } }