Clear android application user data

后端 未结 7 690
走了就别回头了
走了就别回头了 2020-12-12 11:20

Using adb shell to clear application data

adb shell pm clear com.android.browser

But when executing that command from appl

7条回答
  •  旧巷少年郎
    2020-12-12 12:11

    // To delete all the folders and files within folders recursively
    File sdDir = new File(sdPath);
    
    if(sdDir.exists())
        deleteRecursive(sdDir);
    
    
    
    
    // Delete any folder on a device if exists
    void deleteRecursive(File fileOrDirectory) {
        if (fileOrDirectory.isDirectory())
        for (File child : fileOrDirectory.listFiles())
            deleteRecursive(child);
    
        fileOrDirectory.delete();
    }
    

提交回复
热议问题