how to get return value onResponse or onError ?
See original GitHub issuei must admit im new in java… sorry for including this in issues hope it would help others inexperience people who using this library. how to get return value in void onResponse Method ?
i have already using OptimusHttp that using Volley in their base connection library. as i know on that library it would support to return any value from OnSuccess method by using Interface Callback.
can u help me how to accomplish it using this library ?
api.get(this.host+"login")
.setPriority(Priority.HIGH)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
try {
// need to return value here such as
**return response; --> error**
} catch (Exception e) {
System.out.println(e.toString());
}
}
@Override
public void onError(ANError anError) {
messageToast("error");
}
});
thanks u
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to return value from onResponse - java - Stack Overflow
One way to do what you're trying to implement, is with a set of Callbacks. You put 2 parameters in your method. onSuccess...
Read more >Rest.li Filters - LinkedIn Open Source
onError is invoked when an exception occurs in one of the filter's methods or if it receives a response error from the previous...
Read more >android - How can I return value from onResponse of Retrofit v2
Important things to notice: The method returns void. ... There's another option where you could make your code reactive.
Read more >Consuming APIs with Retrofit | CodePath Android Cliffnotes
Assuming you have the JSON response already, go to jsonschema2pojo. Make sure to select JSON as the Source Type: Set the Annotation style...
Read more >Modeling Retrofit Responses With Sealed Classes and ...
In this post, you will cover how to model Retrofit responses with Coroutines and Sealed classes to reduce code complexity and make your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This library always does the network in the background thread and return in the main thread by default.
thank u sir. "onResponse returns in main thread after doing work in " this line help me understand the thread involved on onResponse method i really appreciate for all your answer and your time sir @amitshekhariitbhu