Advertisement
wildanfuady

SplashScreenActivity

Nov 22nd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class SplashScreenActivity : AppCompatActivity() {
  2.  
  3. override fun onCreate(savedInstanceState: Bundle?) {
  4. super.onCreate(savedInstanceState)
  5. setContentView(R.layout.activity_splash_screen)
  6. // hide app bar
  7. supportActionBar?.hide()
  8. // jalankan fungsi update progress
  9. updateProgress()
  10. }
  11.  
  12. private fun updateProgress(){
  13.  
  14. var handler = Handler()
  15. var run = Runnable {
  16.  
  17. var progress: Int = progressbar.progress
  18. progressbar.progress = progress + 10
  19.  
  20. if (progress < 100){
  21. updateProgress()
  22. } else {
  23. val intent = Intent(this, LoginActivity::class.java)
  24. startActivity(intent)
  25. finish()
  26. }
  27. }
  28. handler.postDelayed(run, 300)
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement