本文整理汇总了Java中com.android.volley.toolbox.GsonRequest类的典型用法代码示例。如果您正苦于以下问题:Java GsonRequest类的具体用法?Java GsonRequest怎么用?Java GsonRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GsonRequest类属于com.android.volley.toolbox包,在下文中一共展示了GsonRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCommonListData
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
@Override
public void getCommonListData(final String requestTag, final int event_tag, String keywords, int page) {
GsonRequest<ResponseImagesListEntity> gsonRequest = new GsonRequest<ResponseImagesListEntity>(
UriHelper.getInstance().getImagesListUrl(keywords, page),
null,
new TypeToken<ResponseImagesListEntity>() {
}.getType(),
new Response.Listener<ResponseImagesListEntity>() {
@Override
public void onResponse(ResponseImagesListEntity response) {
loadedListener.onSuccess(event_tag, response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadedListener.onException(error.getMessage());
}
}
);
gsonRequest.setShouldCache(true);
gsonRequest.setTag(requestTag);
VolleyHelper.getInstance().getRequestQueue().add(gsonRequest);
}
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:27,代码来源:ImagesListInteractorImpl.java
示例2: getVideoUser
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
@Override
public void getVideoUser(String requestTag, int user_id) {
GsonRequest<VideosListUserEntity> gsonRequest = new GsonRequest<VideosListUserEntity>(
UriHelper.getInstance().getVideoUserUrl(user_id),
null,
new TypeToken<VideosListUserEntity>() {
}.getType(),
new Response.Listener<VideosListUserEntity>() {
@Override
public void onResponse(VideosListUserEntity response) {
loadedListener.onSuccess(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadedListener.onException(error.getMessage());
}
}
);
gsonRequest.setShouldCache(true);
gsonRequest.setTag(requestTag);
VolleyHelper.getInstance().getRequestQueue().add(gsonRequest);
}
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:27,代码来源:GetVideoUserInteractorImpl.java
示例3: prepareRequest
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
/**
* Adds request with specified arguments to request queue
*
* @param url - URL
* @param method - Request method {@link Method}
* @param clazz - Class for parameterization while decoding from json to specified type
* @param headers - Additional headers which can provided in request
* @param listener - Response listener which called when response successfully received
* @param errorListener - Response listener which called when something went wrong
* @param requestData - Body to post with request
*/
private <T> void prepareRequest(
String url,
int method,
Class<T> clazz,
Map<String, String> headers,
Listener<T> listener,
ErrorListener errorListener,
String requestData ) {
if(headers == null)
headers = new HashMap<String, String>();
GsonRequest<T> request = new GsonRequest<T>(
url,
method,
clazz,
headers,
listener,
errorListener != null ? errorListener : mDefaultListener);
addToQueue(request);
}
开发者ID:xgear-public,项目名称:Whois,代码行数:34,代码来源:RestHelper.java
示例4: getMusicListData
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
@Override
public void getMusicListData(String requestTag, String keywords, final int event_tag) {
TLog.d(requestTag, UriHelper.getInstance().getDoubanPlayListUrl(keywords));
GsonRequest<ResponseMusicsListentity> gsonRequest = new GsonRequest<ResponseMusicsListentity>(
UriHelper.getInstance().getDoubanPlayListUrl(keywords),
null,
new TypeToken<ResponseMusicsListentity>() {
}.getType(),
new Response.Listener<ResponseMusicsListentity>() {
@Override
public void onResponse(ResponseMusicsListentity response) {
loadedListener.onSuccess(event_tag, response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadedListener.onException(error.getMessage());
}
}
);
gsonRequest.setShouldCache(true);
gsonRequest.setTag(requestTag);
VolleyHelper.getInstance().getRequestQueue().add(gsonRequest);
}
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:28,代码来源:MusicsInteracotrImpl.java
示例5: getCommonListData
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
@Override
public void getCommonListData(final String requestTag, final int event_tag, String keywords, int page) {
TLog.d(requestTag, UriHelper.getInstance().getVideosListUrl(keywords, page));
GsonRequest<ResponseVideosListEntity> gsonRequest = new GsonRequest<ResponseVideosListEntity>(
UriHelper.getInstance().getVideosListUrl(keywords, page),
null,
new TypeToken<ResponseVideosListEntity>() {
}.getType(),
new Response.Listener<ResponseVideosListEntity>() {
@Override
public void onResponse(ResponseVideosListEntity response) {
loadedListener.onSuccess(event_tag, response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadedListener.onException(error.getMessage());
}
}
);
gsonRequest.setShouldCache(true);
gsonRequest.setTag(requestTag);
VolleyHelper.getInstance().getRequestQueue().add(gsonRequest);
}
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:29,代码来源:VideosListInteractorImpl.java
示例6: get
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
public static <T> Request<T> get(String url, Class<T> clazz,
Response.Listener<T> listener,
Response.ErrorListener errorListener, boolean needUrlDecode) {
RequestQueue queue = sInstance.getRequestQueue();
GsonRequest<T> request = new GsonRequest<T>(url, clazz, listener,
errorListener, needUrlDecode);
request.setRetryPolicy(new DefaultRetryPolicy(5000, 5, 2.f));
return queue.add(request);
}
开发者ID:Flame-Team,项目名称:FastOmiai,代码行数:11,代码来源:NetworkRequest.java
示例7: post
import com.android.volley.toolbox.GsonRequest; //导入依赖的package包/类
public static <T> Request<T> post(String url,
final Map<String, String> params, Class<T> clazz,
Response.Listener<T> listener, Response.ErrorListener errorListener) {
RequestQueue queue = sInstance.getRequestQueue();
GsonRequest<T> request = new GsonRequest<T>(Request.Method.POST, url, clazz, listener,
errorListener, false) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return params;
}
};
return queue.add(request);
}
开发者ID:Flame-Team,项目名称:FastOmiai,代码行数:14,代码来源:NetworkRequest.java
注:本文中的com.android.volley.toolbox.GsonRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论