Handler and looper in splash
if(activity?.intent?.extras == null) {
Handler(Looper.getMainLooper()).postDelayed({
//check if user is already logged in
if (FirebaseAuth.getInstance().currentUser != null) {
try{
findNavController().navigate(R.id.action_splashScreenFragment_to_inStoreTransactionsFragment)
}catch (e: Exception){
e.printStackTrace()
}
} else {
try {
view.findNavController().navigate(R.id.splash_screen_to_login_fragment)
} catch (e: Exception) {
e.printStackTrace()
}
}
}, 1000)
}
Comments
Post a Comment