我想在我的应用中更新个人资料图片。每次用户更新他的个人资料图片。但问题是个人资料图片仅在我从内存中清除应用程序后重新启动应用程序时更新。
我想自动实现的代码放在onCreate方法中。上传的图片将始终来自内部存储。代码附在下面。
mImageView = findViewById(R.id.profile_Pic);
ContextWrapper cw = new ContextWrapper(getApplicationContext());
File directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
File myImageFile = new File(directory, "my_image.jpeg");
Picasso.get().load(myImageFile).into(mImageView);
我希望当用户更新他/她的 dp 时,个人资料图片的 IMageView 始终自动更新。我应该做什么或应该在哪里放置该代码?