Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created November 12, 2023 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/70127db271943b87dc01677316682f06 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/70127db271943b87dc01677316682f06 to your computer and use it in GitHub Desktop.
Android Studio Prevent Dialog From Closing 2
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.btn).setOnClickListener {
val dialogFragment = MyDialogFragment()
dialogFragment.isCancelable = false
dialogFragment.show(supportFragmentManager, "my_dialog")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment