user1951072 user1951072 - 3 months ago 24x
Android Question

android mkdirs in SD card return me, it spends me 3days

I want to create a folder in SD card ,and i already add the permission

<user-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

in manifest file.below is my code,but mkdirs return false! Can you help me!

File exportDir = new File(
Environment.getExternalStorageDirectory().toString(), "happydiarybackup");
if (!exportDir.exists()) {
boolean a = exportDir.mkdirs();
Log.d("mkdir ",exportDir.getAbsolutePath() + " make "+ a);


Try this. It might help you.

String fullPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/happydiarybackup/";
    File dir = new File(fullPath);
    if (!dir.exists()) {
 catch (Exception e) {
   Log.e("App", "Exception" + e.getMessage());