Image Show By Timer Android Studio

[Solved] Image Show By Timer Android Studio | Kotlin - Code Explorer | yomemimo.com
Question : image show by timer android studio

Answered by : different-duck-fsftdw34rqd9

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); }
}

Source : https://stackoverflow.com/questions/16230352/how-to-display-a-random-image-for-x-second-once-the-activity-is-first-brought-up | Last Update : Wed, 06 Jan 21

Answers related to image show by timer android studio

Code Explorer Popular Question For Kotlin