Advertisement
Guest User

Untitled

a guest
Mar 1st, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // Login button
  2. Button loginButton = (Button) findViewById(R.id.loginBtn);
  3. loginButton.setOnClickListener(new Button.OnClickListener()
  4. {
  5. public void onClick(View v)
  6. {
  7. loginTask.execute("");
  8. }
  9. });
  10.  
  11.  
  12. // Background login thread
  13. private AsyncTask<Object, String, String> loginTask = new AsyncTask<Object, String, String>(){
  14.  
  15. @Override
  16. protected String doInBackground(Object... arg0)
  17. {
  18. Log.v(TAG, "Login task started");
  19. LoginManager lm = new LoginManager();
  20. String username = emailText.getText().toString();
  21. String password = passwordText.getText().toString();
  22. loginBundle = new Bundle();
  23. loginBundle.putString(Constants.LOGIN_HANDLER_ID, lm.login(username, password));
  24. loginMessage = Message.obtain(null, 0);
  25. loginMessage.setData(loginBundle);
  26. loginHandler.sendMessage(loginMessage);
  27. return "";
  28. }
  29.  
  30. };
  31.  
  32. new LoginTask().execute("");
  33.  
  34. private class LoginTask extends
  35. AsyncTask<Object,String, String> {
  36. .....
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement