The code below loads images into a fullscreen activity in my application. They come from a listview then load into a details_activity, so I open them into the fullscreen activity.
I noticed that they are stored into sd card storage only when I open them fullscreen. So, could anybody tell me please what is the best way to delete the images after returning to details_activity or after closing the app?
public class FullScreenActivity extends Activity {
PhotoViewAttacher mAttacher;
ShareActionProvider mShareActionProvider;
private static final String TAG_ARQUIVO = "arquivo";
String path;
File file;
Intent shareIntent;
ImageView fullImg;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_full_screen);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    fullImg = (ImageView) findViewById(R.id.fullImage);
    Intent i = getIntent();
    path = i.getStringExtra(TAG_ARQUIVO);
    Picasso.with(FullScreenActivity.this).load(path).into(fullImg);
    mAttacher = new PhotoViewAttacher(fullImg);
    Uri bmpUri = getLocalBitmapUri(fullImg);
    shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.full_screen, menu);
    MenuItem item = menu.findItem(R.id.menu_item_share);
    mShareActionProvider = (ShareActionProvider) item.getActionProvider();
    if (mShareActionProvider != null) {
        mShareActionProvider.setShareIntent(shareIntent);
    }
    return true;
}
// Returns the URI path to the Bitmap displayed in specified ImageView
public Uri getLocalBitmapUri(ImageView imageView) {
    // Extract Bitmap from ImageView drawable
    Drawable drawable = imageView.getDrawable();
    Bitmap bmp = null;
    if (drawable instanceof BitmapDrawable){
       bmp = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
    } else {
       return null;
    }
    // Store image to default external storage directory
    Uri bmpUri = null;
    try {
        File file =  new File(Environment.getExternalStoragePublicDirectory(  
            Environment.DIRECTORY_DOWNLOADS), "share_image_" + System.currentTimeMillis() + ".png");
        file.getParentFile().mkdirs();
        FileOutputStream out = new FileOutputStream(file);
        bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
        out.close();
        bmpUri = Uri.fromFile(file);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return bmpUri;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
}
EDIT
I tried the code below to delete the image when I press android native back button but it didn´t work:
PicassoTools.java
public class PicassoTools {
  public static void clearCache(Picasso p) {
    p.cache.clear();
  }
}
FullScreen.java:
@Override
public void onBackPressed() {
    PicassoTools.clearCache(Picasso.with(FullScreenActivity.this));
    super.onBackPressed();
}
