Advertisement
Guest User

Untitled

a guest
Sep 12th, 2016
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. public void executeLogin(View v) throws JSONException {
  2. final EditText loginText = (EditText) findViewById(R.id.email_white_edit);
  3. final EditText loginPassword = (EditText) findViewById(R.id.password_edit);
  4. boolean net= executeCammand();
  5. boolean netstat= InternetCheck.isInternetAvailable();
  6. if (net==true&&netstat==true) {
  7. // System.out.println("net available");
  8. }
  9. else if (net==false) {
  10. // System.out.println("net unavailable");
  11. final AlertDialog.Builder ad = new AlertDialog.Builder(this);
  12. ad.setTitle("Error! ");
  13. // ad.setIcon(android.R.drawable.btn_star_big_on);
  14. ad.setPositiveButton("Close", null);
  15. ad.setMessage("No internet connection");
  16.  
  17. ad.show();
  18. finishActivity(0);
  19. }
  20. String username = loginText.getText().toString();
  21. String password = loginPassword.getText().toString();
  22.  
  23. String urlLogin = "http://ga.aquawams.com/api/xhr_request_user_info.php?username=" + username + "&password=" + password;
  24.  
  25. String resultServer = gethttp.getHttpPost(urlLogin, params);
  26.  
  27. String strError = "incorrect username and/or password";
  28.  
  29. if(result.equals("false"))
  30. {
  31. // Dialog
  32. final AlertDialog.Builder ad = new AlertDialog.Builder(this);
  33. ad.setTitle("Error! ");
  34. // ad.setIcon(android.R.drawable.btn_star_big_on);
  35. ad.setPositiveButton("Close", null);
  36. ad.setMessage(strError);
  37. ad.show();
  38. // loginText.setText("");
  39. loginPassword.setText("");
  40.  
  41. }else if (result.equals("true")){
  42. Intent newActivity = new Intent(this, drawer.class);
  43. startActivity(newActivity);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement