hi in below code else inside if condition inside not checking if username , password matches admin user found directly it's checking if after else if checking.but inside else under if condition not going.
java
else{ querystring = "username=" + username + "&password=" + password ; string usertype = databaseutility.executequeryphp("login",querystring); system.out.print(usertype); if(usertype.equalsignorecase("admin user found")){ runonuithread(new runnable() { public void run(){ toast.maketext(login.this, "login sucess", toast.length_long).show(); } }); intent in=new intent(login.this, reports.class); startactivity(in); } else if(usertype.equalsignorecase("no user found")){ runonuithread(new runnable() { public void run() { tv2.settext("invalid username , password"); } }); } }
why not using else
instead of else if
???
problem cant java,
debug app , check value of variable usertype
different.
if cant debug can show toast check value.
if (!isinternetpresent) { showalertdialog(login.this, "no internet connection", "you don't have internet connection.", true); return; } //// if condition finishes string username = usname.gettext().tostring(); string password = pword.gettext().tostring(); // string name = user.get(sessionmanager.key_username); if (username.equals("")) { toast.maketext(login.this, "enter username", toast.length_long).show(); } //// if condition finishes if (password.equals("")) { toast.maketext(login.this, "enter password", toast.length_long).show(); } //// if condition finishes else if (!checkusername(username) && !checkpassword(password)){ toast.maketext(login.this, "enter valid username & password", toast.length_long).show(); } //// else if condition finishes else{ querystring = "username=" + username + "&password=" + password ; string usertype = databaseutility.executequeryphp("login",querystring); system.out.print(usertype); if(usertype.equalsignorecase("admin user found")){ runonuithread(new runnable() { public void run() { toast.maketext(login.this, "login sucess", toast.length_long).show(); } }); intent in=new intent(login.this, reports.class); startactivity(in); } //// if condition finishes //// suppose else if talking else if(usertype.equalsignorecase("no user found")){ runonuithread(new runnable() { public void run() { tv2.settext("invalid username , password"); } }); } //// else if condition finishes } //// else condition finishes
i hope helps.
luck :)
Comments
Post a Comment