When you click on the button, the following actions are performed: start a countdown timer and assign an ImageView photo. And so with each press (the timer starts again).
button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startCountdownTimer(); int imageResource = getResources().getIdentifier( flag, "drawable", getActivity().getPackageName()); imageView.setImageResource(imageResource); } }); There was a problem when you press the button, the countdown timer starts instantly, and the photo is assigned with a delay (2-3 seconds). Photo weight 300 kB. With a photo of 2-10 kB there are no such problems.
In which direction do I need to solve this problem?