Android Dialog return String?
<p>Hi I am popping up dialog to take comments from user.   And returning a value according to that. That "rcomment" is a global variable. And it returns null. This is not working. What am I doing wrong ?</p>

<pre><code> public String getDoNotBoardDialog(final int groupposition)
     {
         final Dialog dia = new Dialog(this);
         dia.requestWindowFeature(Window.FEATURE_NO_TITLE); 
         dia.setContentView(R.layout.donotboard);
         final EditText donotedit = (EditText) dia.findViewById(R.id.donotboardcomment);
         donotedit.setText(""); 

         Button button1 = (Button) dia.findViewById(R.id.donotboardbutton);
         button1.setOnClickListener(new OnClickListener() {
             public void onClick(View v) {
                 r =  donotedit.getText().toString();
                 String boardingComment = getString(R.string.donotboard) + " " + r;
                 PostCommentForAC(groupposition, boardingComment);
                 Intent intent = new Intent(getBaseContext(), TestExList.class); 
                 intent.putExtra("EmpID", empid);
                 startActivity(intent);
                 rcomment = "true";
                 dia.cancel();
        }
       });
          Button button2 = (Button) dia.findViewById(R.id.boardbutton);
          button2.setOnClickListener(new OnClickListener() {
              public void onClick(View v) {
                rcomment = "false";
            dia.cancel();
        }
       });
      dia.show();
    return rcomment;
     }
</code></pre>
