I am making an app to list the uploaded files and then I want to download them with an setOnItemLongClickListener.I get download url and use it to get reference for the download process.When I click on a listview item,it says download is succesful.But I can not see the file on my phone.Actually I have no idea about where it should be. I saw similar questions but I could not find a solution.I really need help to solve this problem.
Here is my code:
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View v,
int index, long arg3) {
try {
storage = FirebaseStorage.getInstance().getReferenceFromUrl(fileFirebase.get(index).toString());
StorageReference island=storage;
final File file = File.createTempFile("images", "jpg");
island.getFile(file).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(getActivity(),"Download is succesful!",Toast.LENGTH_LONG).show();
}
}).addOnProgressListener(new OnProgressListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) {
//taskSnapshot.getBytesTransferred();
//taskSnapshot.getTotalByteCount();
}
});}
catch (IOException e) {
e.printStackTrace();
}