Androidでプログラミング(Java)で書くときに、import設定が地味に面倒だったのでまとめる。
アラート用ダイアログのインポート
import android.app.AlertDialog;
//以降サンプルコード
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("ここにメッセージを表示します。");
builder.show();
SDKのバージョンチェックのインポート
import android.os.Build;
//以降サンプルコード
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//ここにプログラムを各
}
通知で利用するインポート
import android.app.NotificationChannel;
import android.app.NotificationManager;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
intentのインポート
import android.content.Intent;