0
この回答は簡単ですが、私は助けが必要です。 私はVolleyへのurl呼び出しを追加し、エラー応答時にエラーがどのようなURLであったかを知る必要があります。たとえば50個の異なるURLを1つのキューに入れて、50人のうちどれが返されたか知りたいエラー。ここでボレーの内部クラスに詳細を渡します
は私のコードです:
public void upload(String passurl) {
StringRequest stringRequest;
// Request a string response
stringRequest = new StringRequest(Request.Method.GET, passurl,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG,"Send successful");
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//***I want the URL that failed here!
error.printStackTrace();
}
});
stringRequest.setRetryPolicy(new DefaultRetryPolicy(30000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
// Add the request to the queue
stringRequest.setShouldCache(false);
stringRequest.setTag(TAG);
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(this.getApplicationContext());
mRequestQueue.start();
}
mRequestQueue.getCache().clear();
mRequestQueue.add(stringRequest);
}
ためpassurl最終作るあなたが入れたときに、エラーが何を言っていますそこのURL?そのエラーがあるときにIDEが示唆していることを読んだことがありますか? –
IDEはpassURLを 'final'にすることを提案していますが、修正すると思います。 – CSchwarz
正しい。そしてそれをやった? –