I'm trying to create asynchronous rest call in Android using a library com.loopj.android.http.AsyncHttpClient
however, i'm unable to implement AsyncHttpResponseHandler's overridden methods because Android Studio cannot find an appropriate import for Header
class
How can I resolve the issue with the Header class not recognized by the Android Studio IDE?
public void onSuccess(int statusCode, Header[] headers, byte[] response) {
// called when response HTTP status is "200 OK"
}
I see that if I mouse over and click on the Header, I get the following message, but I don't know how to select one of the multiple choices in this menu (moving the mouse dismisses it)
The answer by Alex is no longer valid as org.Apache.http is deprecated from API level 22.
Please replace all references of org.apache.http to cz.msebera.android.httpclient and use version 1.4.9 of loopj which includes the library.
For those who use gradle change your dependencies in build.gradle
dependencies {
compile 'com.loopj.android:android-async-http:1.4.9'
}
Rebuild and then import cz.msebera.android.httpclient to use Header.
By the time I typed this question, I found the answer, hopefully it will help you:
Press Option + enter on Mac when this popup is visible, then select import org.apache.http.Header;
from the dropdown menu:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With