My dialog box below does not work, Please correct

Posted by Mukul Shukla on Stack Overflow See other posts from Stack Overflow or by Mukul Shukla
Published on 2012-10-18T10:57:46Z Indexed on 2012/10/18 11:00 UTC
Read the original article Hit count: 288

Filed under:
|
pbutton.setOnClickListener(new OnClickListener()
    {   private AlertDialog show;
        public void onClick(View arg0)
        {   
            if ((input1.getText().length() == 0) || (input1.getText().toString().equals(" ")) || (input2.getText().length() == 0) || (input2.getText().toString().equals(" "))|| (input1.getText().toString().equals(""))||(input2.getText().toString().equals("")))
            {

            show = new AlertDialog.Builder(MainActivity.this).setTitle("Error").setMessage("Some inputs are empty").setPositiveButton("OK", null).show();
            }
            double result = new Double(input1.getText().toString())+ new Double(input2.getText().toString());
            output.setText(Double.toString(result));

        }

I've also tried passing the context which also doesn't work

© Stack Overflow or respective owner

Related posts about android

Related posts about dialog