Мой код должен изменить имя фотографии, когда я беру новую, но это делает имя фотографии нулевым.Это мой код для создания нового имени и создания файла:
public static File createTempImageFile(File storageDir) throws
IOException
{
String timeStamp = new SimpleDateFormat("dd-MM-yyyy hh-mm-ss", Locale.getDefault()).format(new Date());
String imageFileName = "photo_" + timeStamp;
return File.createTempFile(
imageFileName,
".jpg",
storageDir
);
}
Это код, где я добавляю файл в хранилище и устанавливаю его в ImageView:
try {
localFile = createTempImageFile(getExternalCacheDir());
final File finalLocalFile = localFile;
mStorageRef.child("images/" + mRereference).getFile(localFile)
.addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
Picasso.with(getBaseContext())
.load(Uri.fromFile(finalLocalFile))
.into(mIVpicture1);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("Load","" + e);
}
});
} catch (IOException e) {
e.printStackTrace();
}