Created
December 21, 2018 05:45
-
-
Save firecatmusic/c532a00a06ed87e422c9438527d25bb6 to your computer and use it in GitHub Desktop.
Easily OnBackPressed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExitActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
finish() | |
} | |
companion object { | |
fun exit(context: Context) { | |
val intent = Intent(context, ExitActivity::class.java) | |
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | |
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) | |
context.startActivity(intent) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment