-
Notifications
You must be signed in to change notification settings - Fork 0
Get list of all categories
More information about request,response and other search street
To use Map query, you must add the
<uses-permission android:name="android.permission.INTERNET" />to your app's manifest. Without this, your app won't be able to connect to the network.
Listener Exemple:
QueryCategory queryCategory = new QueryCategory(new QueryCategory.OnCallbackResult() {
@Override
public void onSuccess(JsonArray result, int statusCode) {
}
@Override
public void onFailure(Throwable throwable) {
}
});or register listener
queryCategory.registerOnCategoryListener( new QueryCategory.OnCallbackResult())To get the values out of the QueryCategory, there’s a sendRequest, example:
queryCategory.getAllCategory(); QueryCategory queryCategory = new QueryCategory(new QueryCategory.OnCallbackResultItem() {
@Override
public void onSuccess(JsonObject result, int statusCode) {
}
@Override
public void onFailure(Throwable throwable) {
}
});queryCategory.getListCompanies(id);To cancel a request, call onCancelRequest() on your Request object. Once cancelled your response handler will never be called. What this means in practice is that you can cancel all of your pending requests in your activity's onStop() method and you don't have to litter your response handlers with checks for getActivity() == null, whether onSaveInstanceState() has been called already, or other defensive boilerplate.
To take advantage of this behavior, you would typically have to track all in-flight requests in order to be able to cancel them at the appropriate time. There is an easier way: you can associate a tag object with each request. You can then use this tag to provide a scope of requests to cancel. For example, you can tag all of your requests with the Activity they are being made on behalf of, and call querySearch.onCancelRequest from onStop(). Here is an example :
- Define object and add it to your requests.
QueryCategory queryCategory; // Assume this exists.
2.In your activity's onStop() method, cancel all requests that have this object.
@Override
protected void onStop () {
super.onStop();
if (queryCategory != null) {
queryCategory.onCancelRequest();
}
}