package com.example.nemophila; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; public class RequestingDialogFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("フレンド申請") .setMessage("IDにあったユーザー") .setPositiveButton("申請を送る", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // ボタンを押した時の処理 } }) .setNegativeButton("キャンセル", null); return builder.create(); } }