Advertisement
wildanfuady

SplashScreenActivity.kt

Feb 8th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. package com.wildanfuady.sekolahku
  2.  
  3. import android.content.Intent
  4. import androidx.appcompat.app.AppCompatActivity
  5. import android.os.Bundle
  6. import android.os.Handler
  7. import kotlinx.android.synthetic.main.activity_splash_screen.*
  8.  
  9. class SplashScreenActivity : AppCompatActivity() {
  10.  
  11. override fun onCreate(savedInstanceState: Bundle?) {
  12. super.onCreate(savedInstanceState)
  13. setContentView(R.layout.activity_splash_screen)
  14. supportActionBar?.hide()
  15. updateProgress()
  16. }
  17.  
  18. private fun updateProgress(){
  19. var handler = Handler()
  20. var run = Runnable {
  21. var progress: Int = progressbar.progress
  22. progressbar.progress = progress + 10
  23. if(progress < 100)
  24. {
  25. updateProgress()
  26. }
  27. else {
  28. val intent = Intent(this, ListActivity::class.java)
  29. startActivity(intent)
  30. finish()
  31. }
  32. }
  33. handler.postDelayed(run,300)
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement