Need Context when no activity is running

前端 未结 5 462
离开以前
离开以前 2021-01-26 08:16

I am displaying a pop up from Notification of my application.But when I check my notification no activity is running from my application so in notification when I show dialogue

5条回答
  •  醉话见心
    2021-01-26 08:59

    @Override
        protected Dialog onCreateDialog(int i) 
        {
                   LayoutInflater factory = LayoutInflater.from(this);
                   final View textEntryView = factory.inflate(R.layout.sendemail, null);
                   final View textEntryView1 = factory.inflate(R.layout.sendemail_title, null);
                  to_id = (EditText) textEntryView.findViewById(R.id.edit_text_sender_mail_id);
                  from_id =(EditText) textEntryView.findViewById(R.id.id);
                  pwd =(EditText) textEntryView.findViewById(R.id.pwd);
    
    
                   return new AlertDialog.Builder(current_activity.this)
                       .setTitle("hello")
                       .setCustomTitle(textEntryView1)
                       .setView(textEntryView)
                       .setPositiveButton("Send", new DialogInterface.OnClickListener() 
                       {
                           public void onClick(DialogInterface dialog, int whichButton)
                           {
    
                        // code here...    
                           }
                       })
                       .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int whichButton)
                           {
                                System.exit(0);
                           }
                       })
                       .create();
    
    
        }
    

提交回复
热议问题