I am trying to leverage the solution shown here, How to get the result of OnPostExecute() to main activity because AsyncTask is a separate class?, and noticed that while the code compiles and is running fine, Android Studio is indicating it is in error and underlining it. New to Android so I would welcome a pointer in the right direction.
Specifically I have this code written:
public class HttpRequest extends AsyncTask <HttpRequestParam, Void, String> {
public AsyncResponse delegate = null;
public HttpRequest(AsyncResponse delegate){
this.delegate = delegate;
}
@Override
protected String doInBackground(HttpRequestParam... hr) { // }
...
}
It all compiles and works great, but Android studio is complaining:
"Cannot access com.foo.bar.HttpRequestParam"
The same complaint surfaces in the routine in MainActivity.java where I invoke the HttpRequest:
new HttpRequest(new AsyncResponse() {
@Override
public void processFinish(String output) {
Log.v(TAG, "registerUser async callback completed");
linearThemepackProgress.setVisibility(View.GONE);
}
}).execute(hr);
HttpRequestParam is a simple class I am using to marshal the specific attributes I need to set on the connection and is part of the package (hence it compiles in spite of generating three errors).
Pointers would be welcome.
I must be missing something and am worried that I am overlooking something that could be fragile. I would welcome any pointers...
UPDATE: the same error indicator appears across the entirety of the invocations from my MainActivity where all the lines below are tagged with an error indicator underline!
HttpRequestParam hr = new HttpRequestParam(mContext, this.userRegistrationString(), null, "POST");
linearThemepackProgress.setVisibility(View.VISIBLE);
Log.v(TAG, "ClientUserRequest: " + hr);
new HttpRequest(new AsyncResponse() {
@Override
public void processFinish(String output) {
Log.v(TAG, "registerUser async callback completed");
linearThemepackProgress.setVisibility(View.GONE);
}
}).execute(hr);
The HttpParamRequest class shown below:
public class HttpRequestParam {
private String mUrl; // The URL to be connected to
private File mFile; // The directory for the temporary file
private String mHttpType; // Whether the HTTP connection is for posting or download
private Context mContext; // User context
HttpRequestParam(Context c, String s, File f, String ht) {
mUrl = s;
mFile = f;
mHttpType = ht;
mContext = c;
}
File getFile() {
return mFile;
}
String getUrl() {
return mUrl;
}
String getType() {
return mHttpType;
}
Context getContext() {
return mContext;
}
}