android - if condition in try process -


i have problem when trying implement condition in "try" process, result of "globalnidn" isi , therefore i've checked in logcat , result fine. :(

 protected void onpostexecute(string data) {         try {   jsonobject jobject = new jsonobject(data);             globalnidn  = null;             globalnidn  = jobject.getstring("nidn");             string password = jobject.getstring("password");             toast.maketext(getbasecontext(),"nidn = "+globalnidn,toast.length_short).show();             if (globalnidn.equals(null)){                 toast.maketext(getbasecontext(),"kosong",toast.length_short).show();              } else {                 toast.maketext(getbasecontext(),"isi",toast.length_short).show();             }          }catch (exception e) {             e.printstacktrace();         }      } 

to test null should not use globalnidn.equals(null)

but rather

globalnidn==null 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -