@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == LOGIN_REQUEST) { Bundle bundle = data.getExtras(); String username = bundle.getString(Constants.USERNAME); String token = bundle.getString(Constants.TOKEN); SPUtils.put(this.getApplicationContext(), Constants.TOKEN, token); SPUtils.put(this.getApplicationContext(), Constants.USERNAME, username); app.user = new User(username, token); menu_login.setText(username); } super.onActivityResult(requestCode, resultCode, data); }
private void clearUserInfo() { SPUtils.remove(this.getApplicationContext(), Constants.USERNAME); SPUtils.remove(this.getApplicationContext(), Constants.TOKEN); app.user = null; }