Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Login button
- Button loginButton = (Button) findViewById(R.id.loginBtn);
- loginButton.setOnClickListener(new Button.OnClickListener()
- {
- public void onClick(View v)
- {
- loginTask.execute("");
- }
- });
- // Background login thread
- private AsyncTask<Object, String, String> loginTask = new AsyncTask<Object, String, String>(){
- @Override
- protected String doInBackground(Object... arg0)
- {
- Log.v(TAG, "Login task started");
- LoginManager lm = new LoginManager();
- String username = emailText.getText().toString();
- String password = passwordText.getText().toString();
- loginBundle = new Bundle();
- loginBundle.putString(Constants.LOGIN_HANDLER_ID, lm.login(username, password));
- loginMessage = Message.obtain(null, 0);
- loginMessage.setData(loginBundle);
- loginHandler.sendMessage(loginMessage);
- return "";
- }
- };
- new LoginTask().execute("");
- private class LoginTask extends
- AsyncTask<Object,String, String> {
- .....
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement