当前位置: 首页>>代码示例>>Java>>正文


Java Listener类代码示例

本文整理汇总了Java中com.android.volley.Response.Listener的典型用法代码示例。如果您正苦于以下问题:Java Listener类的具体用法?Java Listener怎么用?Java Listener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Listener类属于com.android.volley.Response包,在下文中一共展示了Listener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeImageRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ImageLoader.java

示例2: getIpWithHost

import com.android.volley.Response.Listener; //导入依赖的package包/类
public static void getIpWithHost(final String host, final OnIpGetListener listener) {
    String now = DateFormatUtils.date2string(new Date(), "yyyy-MM-dd'T'HH:mm:ss");
    if (getCachedDate(host) == null || DateFormatUtils.getDifference(getCachedDate(host),
            now) > 3600000) {
        RequestManager.addRequest(new StringRequest(String.format(freeUrl, new
                Object[]{host}), new Listener<String>() {
            public void onResponse(String response) {
                Helper.showLog(DnspodFree.TAG, host + "," + response);
                if (!TextUtils.isEmpty(response)) {
                    String ip = response.split(DnspodFree.IP_SPLIT)[0];
                    if (!TextUtils.isEmpty(ip)) {
                        ip = ip.trim();
                    }
                    if (RegularUtils.isIP(ip)) {
                        OnePreference.getInstance(MyApplication.getContext()).putString(host,
                                ip + "," + DateFormatUtils.currentTimeString());
                    }
                }
                if (listener != null) {
                    listener.onIpGet();
                }
            }
        }, null), null);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:DnspodFree.java

示例3: getIpWithHostNoCache

import com.android.volley.Response.Listener; //导入依赖的package包/类
public static void getIpWithHostNoCache(final String host, final boolean isSplit) {
    RequestManager.addRequest(new StringRequest(String.format(freeUrl, new Object[]{host}),
            new Listener<String>() {
        public void onResponse(String response) {
            String ip = response;
            if (!TextUtils.isEmpty(ip)) {
                if (isSplit) {
                    ip = response.split(DnspodFree.IP_SPLIT)[0];
                }
                if (!TextUtils.isEmpty(ip)) {
                    ip = ip.trim();
                }
                OnePreference.getInstance(MyApplication.getContext()).putString(host, ip);
            }
        }
    }, null), null);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:DnspodFree.java

示例4: requestJson

import com.android.volley.Response.Listener; //导入依赖的package包/类
private void requestJson() {
    RequestManager.addRequest(new StringRequest("http://shop.boohee" +
            ".com/store/pages/story_json", new Listener<String>() {
        public void onResponse(String response) {
            try {
                List<Story> stories = Story.parseStory(response);
                if (stories != null && stories.size() > 0) {
                    WelcomeActivity.this.mDataList.clear();
                    WelcomeActivity.this.mDataList.addAll(stories);
                    WelcomeActivity.this.mAdapter.notifyDataSetChanged();
                    stories.clear();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            WelcomeActivity.this.setRefresh(false);
        }
    }, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            Helper.showToast(error.toString());
            WelcomeActivity.this.setRefresh(false);
        }
    }), this);
    setRefresh(true);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:WelcomeActivity.java

示例5: JRYGRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public JRYGRequest(int method, String url, Class<T> clazz, Map<String, Object> params, Response.Listener<T> listener, Response.ErrorListener errorListener) {
    super(method, url, errorListener);
    this.url = url;
    this.mListener = listener;
    this.errorListener = errorListener;
    this.mClazz = clazz;
    this.mParams = params;
    body = getBodyString();
}
 
开发者ID:wangzhaosheng,项目名称:publicProject,代码行数:10,代码来源:JRYGRequest.java

示例6: ImageRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public ImageRequest(String url, Listener<Bitmap> listener, int maxWidth, int maxHeight, ScaleType scaleType, Config decodeConfig, ErrorListener errorListener) {
    super(0, url, errorListener);
    setRetryPolicy(new DefaultRetryPolicy(1000, 2, IMAGE_BACKOFF_MULT));
    this.mListener = listener;
    this.mDecodeConfig = decodeConfig;
    this.mMaxWidth = maxWidth;
    this.mMaxHeight = maxHeight;
    this.mScaleType = scaleType;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:ImageRequest.java

示例7: BaseJsonRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public BaseJsonRequest(int method, String url, JsonParams jsonParams, Listener<String>
        listener, ErrorListener errorListener) {
    JsonParams jsonParams2;
    String bestUrl = DnspodFree.getBestUrl(url);
    String host = Uri.parse(url).getHost();
    if (jsonParams == null) {
        jsonParams2 = null;
    } else {
        jsonParams2 = jsonParams;
    }
    this(method, bestUrl, host, jsonParams2, listener, errorListener);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:BaseJsonRequest.java

示例8: makeImageRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        public void onResponse(Bitmap response) {
            ImageLoader.this.onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            ImageLoader.this.onGetImageError(cacheKey, error);
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:ImageLoader.java

示例9: JsonRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:JsonRequest.java

示例10: StringRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public StringRequest(String url, Map<String, String> map, Listener<String> listener, ErrorListener errorListener) {
    super(Method.GET, Constants.BASE_URL + url, errorListener);
    super.setShouldCache(false);
    mListener = listener;
    mMap = map;
}
 
开发者ID:DoloresTeam,项目名称:dolores-android,代码行数:7,代码来源:StringRequest.java

示例11: RawRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public RawRequest(String url, Listener<byte[]> listener, ErrorListener errorListener) {
  super(0, url, errorListener);
  this.mListener = listener;
  setShouldCache(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:RawRequest.java

示例12: JsonArrayRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public JsonArrayRequest(int method, String url, Listener<JSONArray> listener, ErrorListener errorListener) {
    super(method, url, null, listener, errorListener);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:JsonArrayRequest.java

示例13: StringRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public StringRequest(String url, Listener<String> listener, ErrorListener errorListener) {
    this(0, url, listener, errorListener);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:StringRequest.java

示例14: JsonObjectPostRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public JsonObjectPostRequest(String url, Listener<JSONObject> listener, ErrorListener errorListener, Map map) {
    super(Method.POST, url, errorListener);
    mListener = listener;
    mMap = map;
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:6,代码来源:JsonObjectPostRequest.java

示例15: CustomRequest

import com.android.volley.Response.Listener; //导入依赖的package包/类
public CustomRequest(String url, Map<String, String> params,
                     Listener<JSONObject> reponseListener, ErrorListener errorListener) {
    super(Method.GET, url, errorListener);
    this.listener = reponseListener;
    this.params = params;
}
 
开发者ID:searchy2,项目名称:AndroidCrossPromotion,代码行数:7,代码来源:CustomRequest.java


注:本文中的com.android.volley.Response.Listener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。