public boolean deleteProject(File directory){
  Log.i(TAG,">>>>>>>>>>>>>>>>>>>>>>>>deleteProject  directory= " + directory.toString());
  if (directory.isDirectory()) {
    String[] filesInDirecory=directory.list();
    for (int i=0; i < filesInDirecory.length; i++) {
      boolean success=deleteProject(new File(directory,filesInDirecory[i]));
      if (!success) {
        return false;
      }
    }
  }
  return directory.delete();
}

public boolean deleteProject ( File directory ) { Log . i ( TAG , ">>>>>>>>>>>>>>>>>>>>>>>>deleteProject  directory= " + directory . toString ( ) ) ; if ( directory . isDirectory ( ) ) { String [ ] filesInDirecory = directory . list ( ) ; for ( int i = 0 ; i < filesInDirecory . length ; i ++ ) { boolean success = deleteProject ( new File ( directory , filesInDirecory [ i ] ) ) ; if ( ! success ) { return false ; } } } return directory . delete ( ) ; }
this method recursively deletes all the file and directory
