来自MySQL的Android图像请求
我有一个奇怪的问题,我上传了一个图像到一个文件夹,并将名称(用户id)和扩展名保存在数据库中,工作正常,但当我更改图像时,它在文件夹中更改,但手机中的图像没有更改,尽管我正在编辑保存图像名称和分机名的SharedPreManager 下面是我如何更改文件夹中的图像及其工作状态来自MySQL的Android图像请求,android,mysql,image,Android,Mysql,Image,我有一个奇怪的问题,我上传了一个图像到一个文件夹,并将名称(用户id)和扩展名保存在数据库中,工作正常,但当我更改图像时,它在文件夹中更改,但手机中的图像没有更改,尽管我正在编辑保存图像名称和分机名的SharedPreManager 下面是我如何更改文件夹中的图像及其工作状态 String uploadId = UUID.randomUUID().toString(); String path = getPath(filepath); try { new
String uploadId = UUID.randomUUID().toString();
String path = getPath(filepath);
try {
new MultipartUploadRequest(this,uploadId,Constants.URL_UPLOADPIC)
.addFileToUpload(path,"image")
.addParameter("id",SharedPrefManager.getInstance(this).getKeyUserId())
.setNotificationConfig(new UploadNotificationConfig())
.setMaxRetries(2)
.startUpload();
String extention = path.substring(path.lastIndexOf("."));
String id = SharedPrefManager.getInstance(getApplicationContext()).getKeyUserId();
SharedPrefManager.getInstance(getApplicationContext()).uploadpicmanager(id+extention);
Toast.makeText(Profile.this, path, Toast.LENGTH_LONG).show();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
下面是更改图像名称的上传Picman
public boolean uploadpicmanager(String id){
SharedPreferences sharedPreferences3 = mCtx.getSharedPreferences(SHARED_PREF_NAME,Context.MODE_PRIVATE);
SharedPreferences.Editor editor3 = sharedPreferences3.edit();
editor3.putString(KEY_IMAGE,id);
editor3.apply();
return true;
}
这里是我如何阅读图像和它的工作良好的第一次上传,但当我改变图片它没有改变。我想知道如果它不在文件夹中,它从哪里得到图像
Picasso.with(getApplicationContext())
.load("http://hello.000webhostapp.com/Shop&Go/customers/"+
SharedPrefManager.getInstance(getApplicationContext()).getKeyImage())
.into(profilepic);
可能毕加索加载了图像的缓存版本 尝试添加
.memoryPolicy(MemoryPolicy.NO_CACHE)
论建筑商
当然,这不是一个好的做法,您应该更改映像的路径名(并删除内存策略)。Picasso.with(getApplicationContext()).load(“SharedPrefManager.getInstance(getApplicationContext()).getKeyImage()).memoryPolicy(memoryPolicy.NO_CACHE.)进入(profilepic);