當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorListener類代碼示例

本文整理匯總了Java中com.android.volley.Response.ErrorListener的典型用法代碼示例。如果您正苦於以下問題:Java ErrorListener類的具體用法?Java ErrorListener怎麽用?Java ErrorListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ErrorListener類屬於com.android.volley.Response包,在下文中一共展示了ErrorListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeImageRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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: Request

import com.android.volley.Response.ErrorListener; //導入依賴的package包/類
public Request(int method, String url, ErrorListener listener) {
    MarkerLog markerLog;
    if (MarkerLog.ENABLED) {
        markerLog = new MarkerLog();
    } else {
        markerLog = null;
    }
    this.mEventLog = markerLog;
    this.mShouldCache = true;
    this.mCanceled = false;
    this.mResponseDelivered = false;
    this.mCacheEntry = null;
    this.mMethod = method;
    this.mUrl = url;
    this.mIdentifier = createIdentifier(method, url);
    this.mErrorListener = listener;
    setRetryPolicy(new DefaultRetryPolicy());
    this.mDefaultTrafficStatsTag = findDefaultTrafficStatsTag(url);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:20,代碼來源:Request.java

示例3: requestJson

import com.android.volley.Response.ErrorListener; //導入依賴的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

示例4: ImageRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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

示例5: JRYGRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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: loadMIBndData

import com.android.volley.Response.ErrorListener; //導入依賴的package包/類
public static void loadMIBndData(final Context context, final MiBandCallBack callBack) {
    String currentDate = DateHelper.today();
    Map<String, String> params = new HashMap();
    params.put("appid", XMPush.APP_ID);
    params.put("third_appid", THIRD_APP_ID);
    params.put("third_appsecret", THIRD_APP_SECRET);
    params.put("call_id", System.currentTimeMillis() + "");
    params.put("access_token", getXMToken());
    params.put("fromdate", currentDate);
    params.put("todate", currentDate);
    params.put("v", "1.0");
    params.put("l", "english");
    RequestManager.addRequest(new JsonObjectRequest(1, buildUrl(XMDataApi, params), new
            OkListener((Activity) context) {
        public void ok(JSONObject object) {
            XiaoMiSportData sportData = (XiaoMiSportData) FastJsonUtils.fromJson(object,
                    XiaoMiSportData.class);
            if (context != null && sportData != null) {
                if (!XiaoMiSportData.KEY_SUCCESS.equals(sportData.message)) {
                    MiBandHelper.lastUpdateTime = System.currentTimeMillis() - 180000;
                    callBack.onFailed("獲取小米手環數據失敗,請綁定小米手環並同步數據~~");
                } else if (sportData.data == null || sportData.data.size() == 0) {
                    callBack.onFailed("今日暫無數據,先同步手環數據~~");
                } else {
                    callBack.onSuccess(((SportData) sportData.data.get(0)).step);
                }
            }
        }
    }, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            MiBandHelper.lastUpdateTime = System.currentTimeMillis() - 180000;
            callBack.onFailed("獲取小米手環數據失敗,請重試~~");
        }
    }), context);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:36,代碼來源:MiBandHelper.java

示例7: BaseJsonRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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.ErrorListener; //導入依賴的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.ErrorListener; //導入依賴的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.ErrorListener; //導入依賴的package包/類
public StringRequest(int method, String url, Listener<String> listener, ErrorListener errorListener) {
    super(method, url, errorListener);
    this.mListener = listener;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:StringRequest.java

示例11: StringRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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

示例12: MockRequest

import com.android.volley.Response.ErrorListener; //導入依賴的package包/類
public MockRequest(String url, ErrorListener listener) {
    super(Request.Method.GET, url, listener);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:MockRequest.java

示例13: JsonObjectRequest

import com.android.volley.Response.ErrorListener; //導入依賴的package包/類
public JsonObjectRequest(String url, JSONObject jsonRequest, Listener<JSONObject> listener, ErrorListener errorListener) {
    this(jsonRequest == null ? 0 : 1, url, jsonRequest, (Listener) listener, errorListener);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:4,代碼來源:JsonObjectRequest.java

示例14: RawRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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

示例15: JsonArrayRequest

import com.android.volley.Response.ErrorListener; //導入依賴的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


注:本文中的com.android.volley.Response.ErrorListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。