Code example for AsyncTaskLoader

0
 
	String mUsername;
	String mPassword;
 
	public LoginLoader(Context context, String username, String password) {
		super(context);
		mUsername = username;
		mPassword = password;
	} 
 
	@Override 
	public Result loadInBackground() {
		if (mUsername == null || mPassword == null) return Result.EMPTY;
 
		String newCookie = LoginManager.login(mUsername, mPassword);
		boolean isSuccess = newCookie != null;
		if (isSuccess) {
			// saves new user cookie and updates the timestamp 
			UserPrefs prefs = new UserPrefs(getContext());
			prefs.saveUserCookie(newCookie);
Connect your IDE to all the code out there  Get Codota for Java