Double back press to exit the application best method (android) in fragment
private var backPressedTime : Long = 0
if (backPressedTime + 2000 > System.currentTimeMillis()) {
requireActivity().finishAffinity()
} else {
showToast(MyApplication.context!!, "Press Back again to exit ", IndiaHaatConstants.ToastType.CUSTOM)
}
backPressedTime = System.currentTimeMillis()
Comments
Post a Comment