null checking edit textbox android

Posted by sara brown on Stack Overflow See other posts from Stack Overflow or by sara brown
Published on 2012-06-29T03:05:59Z Indexed on 2012/06/29 3:16 UTC
Read the original article Hit count: 169

Filed under:
|

i want to make empty textbox checking for android. i tried try catch but it was force to close.

below is my codes

 try{
                    name    = (EditText)findViewById(R.id.name);    
                    }catch(NullPointerException ex){
                        new AlertDialog.Builder(KawalanAppXTVT.this).setTitle("Error" )
                        .setMessage("That's not a number")
                        .setPositiveButton("OK", null).show();

can someone help me?

© Stack Overflow or respective owner

Related posts about android

Related posts about try-catch