电子邮件意图onactivity结果显示Result_Ok上的alertDialog

时间:2017-03-08 09:36:39

标签: java android

代码在这里

 @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);  
    }

1 个答案:

答案 0 :(得分:0)

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

 // 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 
    }  
}