title: Android Delete File Using URI not working
body: <p>So what i want is to <strong>delete file using URI</strong></p>
  
  <p><strong>Do not flag is duplicate</strong></p>
  
  <p>I tried many answer but nothing worked here is the question i tried</p>
  
  <p><a href="https://stackoverflow.com/questions/42877908/how-to-delete-file-that-is-created-using-uri">How to delete file that is created using Uri?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/41717756/delete-file-using-uri">Delete file using Uri</a></p>
  
  <p><a href="https://stackoverflow.com/questions/42877908/how-to-delete-file-that-is-created-using-uri">How to delete file that is created using Uri?</a></p>
  
  <p>I write code to get images from gallery and then copy it to directory called ".blackhat" and delete original one (Kind of Move File Function)..But it's not working. even it is not generation Log so i can check the error.
  this code working proper for copying file but not deleting after copying....</p>
  
  <pre><code>if(requestCode == 2 &amp;&amp; data.getData() !=null){
          if(cd == null){
              path.add(data.getData());
              Random rn = new Random();
              if(copyFileFromUri(this,data.getData(),String.valueOf(rn.nextInt(500)))){
                  File fdelete = new File(data.getData().getPath());
                  if (fdelete.exists()) {
                      if (fdelete.delete()) {
                          Log.d("delete","deleted");
                      } else {
                          Log.d("delete","not deleted");
                      }
                  }
                  Toast.makeText(this, "Done", Toast.LENGTH_SHORT).show();
              }
  
          }else{
              for(int i=0;i&lt;data.getClipData().getItemCount();i++){
                  path.add(data.getClipData().getItemAt(i).getUri());
                  Log.d("RjList",path.get(i).toString());
                  Random rn=new Random();
                  if(copyFileFromUri(this,data.getClipData().getItemAt(i).getUri(),String.valueOf(rn.nextInt(500)))){
                      File fdelete = new File(data.getClipData().getItemAt(i).getUri().getPath());
                      if (fdelete.exists()) {
                          if (fdelete.delete()) {
                              Log.d("delete","deleted");
                          } else {
                              Log.d("delete","not deleted");
                          }
                      }
                      Toast.makeText(this, "Done", Toast.LENGTH_SHORT).show();
                  }
              }
          }
      }
  </code></pre>
  
  <p>Where am i doing wrong ????
  Thank in advance...</p>