0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Kotlin 初心者】物理ボタンで戻れないようにする onKeyDown

Posted at

やりたいこと

Androidの物理ボタン(呼び方がこれでいいのかは不明)で一つ前の画面に戻ることを防ぐために、onKeyDownの関数を使います。

override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
  //条件分岐やモーダル表示などの処理を書きます
  return false
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?