首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Andorid:在其他应用上显示对话

Andorid:在其他应用上显示对话
EN

Stack Overflow用户
提问于 2019-10-21 13:01:49
回答 1查看 444关注 0票数 0

我有一个问题:我可以在另一个应用程序上显示警报对话框吗?

我想在用户收到消息时通知他。显示标准通知是不够的。但是当我创建一个AlertDialog时,它不能在其他应用程序上显示。

代码语言:javascript
复制
  private void showAlertDialog(View view, Order order, Order oldOrder) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        LayoutInflater inflater = LayoutInflater.from(context);
        View content = inflater.inflate(R.layout.dialog_extra_info, null);
        builder.setView(content);
        final EditText etKmCounter = content.findViewById(R.id.et_km_counter);
        final EditText etMotoHourCounter = content.findViewById(R.id.et_counter_moto_hour);
        final AlertDialog ad = builder.show();

        Button btnSave = content.findViewById(R.id.save);
        btnSave.setOnClickListener(v -> {
            if (StringUtils.isEmpty(etKmCounter.getText().toString()) || StringUtils.isEmpty(etMotoHourCounter.getText().toString())) {
                openFillDataAlertDialog();
            } else {
                ad.dismiss();
            }
        });
    }
EN

回答 1

Stack Overflow用户

发布于 2019-10-21 13:40:32

你需要有ACTION_MANAGE_OVERLAY_PERMISSION权限才能在你的应用程序未打开时显示提醒对话框,或者如果你也想在其他应用程序上显示对话框。

检查这个链接,我在这里提到了所有细节:pop up wiindow with notification even apllication is not running

How to make AlertDialog view in Input method Service?

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58480052

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档