Reputation: 1195
I was browsing through a Repo for a Reddit app on Github. Now, For the link between between the dialog and the Task they choose to add:
public abstract void onLoginChosen(String user, String password);
They then have a Task class that handles the data and makes and receives the input and then parses it to the UI.
I don't understand, how does the abstraction in this constructor then go onto to the Task.
There task doesn't even extend this dialog task.
public class LoginTask extends AsyncTask<Void, Void, Boolean> {
private static final String TAG = "LoginTask";
protected String mUsername;
private String mPassword;
protected String mUserError = null;
private RedditSettings mSettings;
private HttpClient mClient;
private Context mContext;
protected LoginTask(String username, String password, RedditSettings settings, HttpClient client, Context context) {
mUsername = username;
mPassword = password;
mSettings = settings;
mClient = client;
mContext = context;
}
@Override
public Boolean doInBackground(Void... v) {
return doLogin(mUsername, mPassword, mSettings, mClient, mContext);
}
How does the data go from one class to another in this example? I'm stumped and it's making this part to understand.
Upvotes: 0
Views: 134
Reputation: 9111
There's an implementation in the Activity here:
and other activities too, where the login dialog is able to be shown.
Side note: that is very old code, and the latest closed source version of the app avoids things like that.
Upvotes: 1