code`
public class CustomeDialog {
Context context;
public CustomeDialog(Context context) {
this.context = context;
}
public void creatDialogBoxWihList() {
final Dialog dialog = new Dialog(context);
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(R.layout.dialog_layout);
// dialog.getWindow().setBackgroundDrawable(null); //for making dialog to fill window completely
Button ok = (Button) dialog.findViewById(R.id.ok);
Button cancel = (Button) dialog.findViewById(R.id.can);
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
Window window = dialog.getWindow();
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}}
を次の中から別のクラスのカスタムダイアログボックスを作成するアンドロイドmenifestsにBroadcastReceiver onReceive機能から
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
呼び出し、このクラスを許可を追加します。あなたがこれに助けが必要な場合。これを使用するlink