正如标题所说,我正在使用凌空上传图像配置文件,但我的图片在上传后没有更新,即使我关闭并重新打开我的应用程序它仍然显示旧图像...这里是代码
final Bitmap image = ((BitmapDrawable) imagePreview.getDrawable()).getBitmap();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
final String encodedImage = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT);
StringRequest imageUserReq = new StringRequest(Request.Method.POST,
Config.URL_UPDATE_USER_PROFILE, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, response.toString());
dialog.dismiss();
try{
JSONObject obj = new JSONObject(response);
imageuser.setImageUrl(obj.getString("image"), imageLoader);
}catch (JSONException e) {
Log.e(TAG, e.getMessage());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Error: " + error.getMessage());
dialog.dismiss();
}
}){
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("image", encodedImage);
params.put("email", email);
Log.e(TAG, "Posting params: " + params.toString());
return params;
}
};
// Adding request to request queue
imageUserReq.setRetryPolicy(new DefaultRetryPolicy(5000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MyApplication.getInstance().addToRequestQueue(imageUserReq);
如果我用后退按钮关闭应用程序并再次打开它,那么凌空加载旧图像但是如果我杀了应用程序它将加载新的应用程序,是否有任何建议?