gpt4 book ai didi

java - Activity 结果上的电子邮件 Intent 在 Result_Ok 上显示警报对话框

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:20 25 4
gpt4 key购买 nike

代码在这里

 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
LayoutInflater inflater = null;
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext());

if(resultCode == Activity.RESULT_CANCELED) return;
else if (resultCode == Activity.RESULT_OK)
inflater = getActivity().getLayoutInflater();
alertDialogBuilder
.setView(inflater.inflate(R.layout.dialog_result_request, null))
.setCancelable(true);
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
alertDialog.setContentView(R.layout.dialog_result_request);
alertDialog.getWindow().setWindowAnimations(R.style.PauseDialogAnimation);
}

最佳答案

onActivityResult 方法中添加代码(如下面的代码),并添加与结果代码匹配的 if 条件。

 // Call Back method  to get the Message form other Activity  
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
// check if the request code is same as what is passed here it is 2
if(requestCode==2)
{
//Do your task here
}
}

关于java - Activity 结果上的电子邮件 Intent 在 Result_Ok 上显示警报对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42667669/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com