メッセージボックスを出す
この記事を作った動機 単に簡易的にメッセージボックス的なものを出す方法を記録するだけ。Toast とかいう名前の API で、win32 API とかの MessageBox と比べて、だいぶ非直感的な名前な気がする。まあ多用すれば慣れるってことなんでしょうけど。。。 メッセージを出す 今回は、ボタンを押したらメッセージが出てくるようにする例を置いてみる。 // 呼び出されたアクティビティの onCreate 関数内にて val registerButton = findViewById<Button>(R.id.Register) registerButton.setOnClickListener{ Toast.makeText(this, "test", Toast.LENGTH_SHORT).show() finish() } 参考にしたサイトとか Toasts overview | Android Developers https://developer.android.com/guide/topics/ui/notifiers/toasts (2025年6月24日) MessageBox function (winuser.h) - Win32 apps | Microsoft Learn https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox (2025年6月24日)