Skip to content

Instantly share code, notes, and snippets.

@psinetron
Created August 14, 2018 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psinetron/cc87b90099f7775b417a9ddd9553046d to your computer and use it in GitHub Desktop.
Save psinetron/cc87b90099f7775b417a9ddd9553046d to your computer and use it in GitHub Desktop.
//Это объяви в самом верху активити
long seconds = 5000; // 5 секунд
Handler handler = new Handler();
//Это в onResume
handler.postDelayed(new Runnable() {
@Override
public void run() {
pb.setVisibility(View.VISIBLE);
handler.postDelayed(this,seconds)
}
}, seconds);
//Это в onStop
handler.removeCallbacksAndMessages(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment