Java tutorial
//package com.java2s; //License from project: Apache License import android.os.Environment; import android.text.TextUtils; import java.io.File; public class Main { public static String getImageSavePath(String fileName) { if (TextUtils.isEmpty(fileName)) { return null; } final File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "MGJ-IM" + File.separator + "images"); if (!folder.exists()) { folder.mkdirs(); } return folder.getAbsolutePath() + File.separator + fileName; } public static File getImageSavePath() { final File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "MGJ-IM" + File.separator + "images"); if (!folder.exists()) { folder.mkdirs(); } return folder; } }