• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GsonRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueFields类代码示例发布时间:2022-05-23
下一篇:
Java ModifyRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap