android - How delete a file from internal storage -


i need delete file internal storage. below code creating file.

 picasso.with(mcontext).load(imageurl).into(new target() {                                 @override                                 public void onbitmaploaded(bitmap bitmap, picasso.loadedfrom from) {                                      try {                                         string root = environment.getexternalstoragedirectory().tostring();                                         file mydir = new file(root + "/omoto images");                                         if (!mydir.exists()) {                                             mydir.mkdirs();                                         }                                         string name = imagename;                                         mydir = new file(mydir, name);                                         fileoutputstream out = new fileoutputstream(mydir);                                         bitmap.compress(bitmap.compressformat.jpeg, 90, out);                                         out.flush();                                         out.close();                                     } catch (exception e) {                                      }                                 }                                  @override                                 public void onbitmapfailed(drawable errordrawable) {                                 }                                  @override                                 public void onprepareload(drawable placeholderdrawable) {                                 }                             }); 

the below code deleting

    string root = environment.getexternalstoragedirectory().tostring();                                         file mydir = new file(root + "/omoto images"); 

mydir.delete();

but deleting not working


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -