Guest User

Untitled

a guest
Apr 25th, 2018
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. Context context;
  2. EditText EmployeeUserName,EmployeePassword;
  3. String username= "",password = "";
  4. @Override
  5. protected void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. if (getSupportActionBar() != null )
  8. getSupportActionBar().hide();
  9. setContentView(R.layout.activity_login);
  10. context = LoginActivity.this;
  11. EmployeeUserName = (EditText) findViewById(R.id.EmployeeUserName);
  12. EmployeePassword = (EditText) findViewById(R.id.EmployeePassword);
  13. }
  14.  
  15. public void onSignInClicked(View paramView) {
  16. Utility.hideSoftKeyboard(context,paramView);
  17.  
  18. username = this.EmployeeUserName.getText().toString();
  19. password = this.EmployeePassword.getText().toString();
  20.  
  21. if(username.isEmpty()){
  22. Utility.displayToast(this,"Please Enter Username");
  23. }else if(password.isEmpty()){
  24. Utility.displayToast(this,"Please Enter Password");
  25. }else{
  26. Log.d("internet ","internet : " + Utility.checkNetworkConnection(context));
  27. if(Utility.checkNetworkConnection(context) == true) {
  28. SharedPreferences.Editor editor = getSharedPreferences(ERPConstant.PREFS_NAME, 0).edit();
  29. editor.putString("USER_NAME", username);
  30. editor.putString("PASSWORD", password);
  31. editor.commit();
  32. Intent localIntent = new Intent(this, LanguageActivity.class);
  33. startActivity(localIntent);
  34. finish();
  35. return;
  36. }else{
  37. Utility.displayToast(this,getResources().getString(R.string.no_internet_connection));
  38. }
  39. }
  40.  
  41. }
Add Comment
Please, Sign In to add comment