Database won’t remove when uninstall the Android Application

in Android 6.0, google added new feature called Auto Backup. when this option is on(default is on), Android system copies almost every directories and files that created by system, and upload it to user’s google drive account. When user reinstalls app, android automatically restore app’s data, no matter how it was installed(via Play store, adb … Read more

File.createTempFile() vs. new File()

1. Create file with random name File file = File.createTempFile(String prefix, String suffix, File parent) Actually create the file on disk and returns the file object Create a file name in this format: prefix + random number + suffix Useful when you need create temporary file on disk 2. Create file with exact name File … Read more

Trying to create a file in Android: open failed: EROFS (Read-only file system)

I have tried this with and without the WRITE_INTERNAL_STORAGE permission. There is no WRITE_INTERNAL_STORAGE permission in Android. How do I create this file for writing? You don’t, except perhaps on a rooted device, if your app is running with superuser privileges. You are trying to write to the root of internal storage, which apps do … Read more

Difference between mkdir() and mkdirs() in java for java.io.File [closed]

mkdirs() also creates parent directories in the path this File represents. javadocs for mkdirs(): Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories. javadocs for mkdir(): Creates the directory named by … Read more

How to create directory automatically on SD card

If you create a File object that wraps the top-level directory you can call it’s mkdirs() method to build all the needed directories. Something like: // create a File object for the parent directory File wallpaperDirectory = new File(“/sdcard/Wallpaper/”); // have the object build the directory structure, if needed. wallpaperDirectory.mkdirs(); // create a File object … Read more

android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

If your targetSdkVersion >= 24, then we have to use FileProvider class to give access to the particular file or folder to make them accessible for other apps. We create our own class inheriting FileProvider in order to make sure our FileProvider doesn’t conflict with FileProviders declared in imported dependencies as described here. Steps to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)