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


Java VolleyLog.e方法代碼示例

本文整理匯總了Java中com.android.volley.VolleyLog.e方法的典型用法代碼示例。如果您正苦於以下問題:Java VolleyLog.e方法的具體用法?Java VolleyLog.e怎麽用?Java VolleyLog.e使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.android.volley.VolleyLog的用法示例。


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

示例1: parseNetworkResponse

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ImageRequest.java

示例2: getBody

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
@Override
public byte[] getBody() throws AuthFailureError {
  if(entity == null) {
    return null;
  }
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
    entity.writeTo(bos);
  }
  catch (IOException e) {
    VolleyLog.e("IOException writing to ByteArrayOutputStream");
  }
  return bos.toByteArray();
}
 
開發者ID:wondenge,項目名稱:payments-Android-SDK,代碼行數:15,代碼來源:PostRequest.java

示例3: getBody

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
@Override
public byte[] getBody() throws AuthFailureError {
  if(entity == null) {
      return null;
  }
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
      entity.writeTo(bos);
  }
  catch (IOException e) {
      VolleyLog.e("IOException writing to ByteArrayOutputStream");
  }
  return bos.toByteArray();
}
 
開發者ID:wondenge,項目名稱:payments-Android-SDK,代碼行數:15,代碼來源:PatchRequest.java

示例4: getSocketFactory

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
static SSLSocketFactory getSocketFactory() {
    if (socketFactory == null) {
        try {
            X509TrustManager trustManager = get509TrustManager();
            SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, new TrustManager[]{trustManager}, null);
            socketFactory = sslContext.getSocketFactory();
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            VolleyLog.e(TAG, "Unable to create the ssl socket factory.");
            return SSLCertificateSocketFactory.getDefault(0, null);
        }
    }
    return socketFactory;
}
 
開發者ID:octaware,項目名稱:super-volley,代碼行數:15,代碼來源:ClientSSLSocketFactory.java

示例5: parseError

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
private Response<T> parseError(VolleyError error, BaseRequest request) {
    HttpResponse.Builder builder = new HttpResponse.Builder()
            .success(false)
            .request(request)
            .message(error.getMessage());

    if (error instanceof NetworkError || error instanceof TimeoutError) {
        VolleyLog.e("Network error.");
        if (error.getCause() instanceof SSLHandshakeException) {
            VolleyLog.e("SSLHandshakeException: Insecure connection");
        }
        return Response.error(builder.build());
    }

    NetworkResponse response = error.networkResponse;
    if (response == null) {
        VolleyLog.e("Local error.");
        return Response.error(builder.build());
    }

    String json = "";
    if (response.data != null) {
        json = new String(response.data);
    }
    ResponseBody body = ResponseBody.create(MediaType.parse(response.headers.get("Content-Type")), json);
    return Response.error(body, builder.raw(json).code(response.statusCode).build());
}
 
開發者ID:octaware,項目名稱:super-volley,代碼行數:28,代碼來源:VolleyCall.java

示例6: initialize

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
   * Initializes the DiskBasedCache by scanning for all files currently in the
   * specified root directory. Creates the root directory if necessary.
   */
  @Override
  public synchronized void initialize() {
    if (!mRootDirectory.exists()) {
      if (!mRootDirectory.mkdirs()) {
        VolleyLog.e("Unable to create cache dir %s", mRootDirectory.getAbsolutePath());
      }
    }
/* DR ÆNDRING - løb ikke igennem cache-mappen, det tager henved 1 sekund per 100 elementer
        File[] files = mRootDirectory.listFiles();
        if (files == null) {
            return;
        }
        for (File file : files) {
            FileInputStream fis = null;
            try {
                fis = new FileInputStream(file);
                CacheHeader entry = CacheHeader.readHeader(fis);
                entry.size = file.length();
                putEntry(entry.key, entry);
            } catch (IOException e) {
                if (file != null) {
                   file.delete();
        }
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
    }
                } catch (IOException ignored) { }
            }
        }
        */
  }
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:38,代碼來源:DrDiskBasedCache.java

示例7: parseNetworkResponse

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
 * Parses the network response {@link NetworkResponse} and returns the expected Type for the request.
 * @param response {@link NetworkResponse} The response for the request (Success or error).
 * @return Response object linked to a specific type
 */
@Override
protected Response<T> parseNetworkResponse(NetworkResponse response) {
    this.networkResponse = response;

    JavaType returnType = getReturnType();
    T returnData = null;
    if (returnType != null) {
        try {
            if (response.data != null) {
                returnData = SpitfireManager.getObjectMapper().readValue(response.data, returnType);
            }
        } catch (Exception e) {
            VolleyLog.e(e, "An error occurred while parsing network response:");
            returnData = null;
        }
    }

    if (returnData == null && classResponse != Void.class) {
        ParseError parseError = new ParseError(response);
        String content = "";
        if (response.data != null) {
            content = new String(response.data);
        }
        VolleyLog.e(parseError, "Return data is null. API returned : "+ content);
        return Response.error(parseError);
    }

    return Response.success(returnData, HttpHeaderParser.parseCacheHeaders(response));
}
 
開發者ID:neopixl,項目名稱:Spitfire,代碼行數:35,代碼來源:AbstractRequest.java

示例8: dispatchUserAuthenticator

import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
 * Authenticates the provided credentials
 */
private void dispatchUserAuthenticator() {
    //Check if user input is valid
    final EditText etUsername = (EditText) mRootView.findViewById(R.id.seabio_configurations_username);
    final EditText etPassword = (EditText) mRootView.findViewById(R.id.seabio_configurations_password);
    final EditText etURL = (EditText) mRootView.findViewById(R.id.seabio_configurations_address);

    if (etUsername.getText().toString().isEmpty()) {
        etUsername.setError(getString(R.string.required));
        return;
    }

    if (etPassword.getText().toString().isEmpty()) {
        etPassword.setError(getString(R.string.required));
        return;
    }

    if (etURL.getText().toString().isEmpty()) {
        etURL.setError(getString(R.string.required));
        return;
    }

    final String baseQuery = etURL.getText().toString();
    bt_sbd_username.setText(getString(R.string.loading));

    //Async request for token
    final StringRequest req = new StringRequest(Request.Method.POST, baseQuery + "/signin?",
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    try {
                        JSONObject responseObj = new JSONObject(response);
                        if (!responseObj.get("status").equals("success")) {
                            bt_sbd_username.setText(getString(R.string.seabio_authenticate_error));
                            bt_sbd_username.setError("");
                            return;
                        }

                        String username = ((JSONObject)responseObj.get("data")).get("name").toString();
                        SBDToken =  ((JSONObject)responseObj.get("data")).get("token").toString();

                        SharedPreferences.Editor editor = settings.edit();
                        if (settings.contains(Utils.TAG_SBD_USERNAME)) {
                            editor.remove(Utils.TAG_SBD_USERNAME);
                        }
                        editor.putString(Utils.TAG_SBD_USERNAME, username);
                        editor.putString(Utils.TAG_SBD_PASSWORD, etPassword.getText().toString());
                        editor.putString(Utils.TAG_SBD_URI, baseQuery);
                        editor.apply();

                        bt_sbd_username.setText(getString(android.R.string.ok));
                        bt_sbd_username.setEnabled(false);

                    } catch (JSONException e) {
                        bt_sbd_username.setText(getString(R.string.seabio_json_error));
                        bt_sbd_username.setError("");
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    VolleyLog.e("Error: ", error.getMessage());
                    bt_sbd_username.setText(getString(R.string.seabio_authenticate_error));
                    bt_sbd_username.setError("");
                }
            }){
        @Override
        protected Map<String,String> getParams(){
            Map<String,String> params = new HashMap<>();
            params.put("username", etUsername.getText().toString());
            params.put("password",etPassword.getText().toString());
            return params;
        }
    };

    // add the request object to the queue to be executed
    LabTablet.getInstance().addToRequestQueue(req);
}
 
開發者ID:feup-infolab,項目名稱:labtablet,代碼行數:82,代碼來源:ConfigurationFragment.java


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