Answers for "image show by timer android studio"

0

image show by timer android studio

public class MainActivity extends Activity {

Random random = new Random();
int max = 2;
int min = 0;

ImageView imageView;

Integer[] image = { R.drawable.ic_launcher, R.drawable.tmp,R.drawable.android };

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    int randomNumber = random.nextInt(max - min + 1) + min;

    imageView = (ImageView) findViewById(R.id.img);

    imageView.setImageResource(image[randomNumber]);

    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            Intent intent = new Intent(MainActivity.this, Act.class);
            startActivity(intent);
        }
    }, 5000);
  }
}
Posted by: Guest on December-30-2020

Code answers related to "image show by timer android studio"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language