我正在开发一个应用程序,我正在更改个人资料照片并将其发送到商店。但是我的问题是在我更新图像并从活动返回并再次进入同一活动后,我的问题,旧图像将在那里替换我发送给服务器的新的。这是保存在服务器中的图像没有进入ImageView。我正在使用Multipart Request将图像发送到服务器。如果有人知道解决方案,请告诉我,我将非常感激。
private class SendGroupPicToServer extends AsyncTask<File, Integer, String> {
@Override
protected String doInBackground(File... params) {
System.out.println("inside do in background " + grp_id + " "
+ userid);
final File imagefile = params[0];
RequestQueue requestQueue = MySingleton.getInstance(
GroupProfile.this).getRequestQueue();
Map<String, String> arguments = new HashMap<String, String>();
arguments.put("group_id", grp_id);
arguments.put("user_id", userid);
MultipartRequest multipartRequest = new MultipartRequest(
updateGroupPicUrl, arguments,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
System.out.println("Response from Abey "
+ response);
try {
ResponseClass rDetails = (new Gson()).fromJson(
response, ResponseClass.class);
if (rDetails.Result.equals("Success")) {
profile.postInvalidate();
}
} catch (Exception e) {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(GroupProfile.this, error.toString(),
Toast.LENGTH_SHORT).show();
System.out.println("Upload Image response is "
+ error.toString());
if (error instanceof NetworkError) {
} else if (error instanceof ServerError) {
} else if (error instanceof AuthFailureError) {
} else if (error instanceof ParseError) {
} else if (error instanceof NoConnectionError) {
} else if (error instanceof TimeoutError) {
}
}
}, imagefile, "IMAGE");
requestQueue.add(multipartRequest);
return null;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
System.out.println("Image updation is " + result);
}
}