Java tutorial
//package com.java2s; import java.io.File; import android.app.Activity; import android.net.Uri; import android.os.Environment; public class Main { private static File mAvatar; private static Uri mAvatarUri; private static Activity mActivity; public static final String TEMP_IMG_PATH = Environment.getExternalStorageDirectory() + "/jiayuan/temp"; private static void initData(Activity activity) { mActivity = activity; File mFile = new File(Environment.getExternalStorageDirectory() + "/jiayuan"); if (!mFile.exists()) mFile.mkdirs(); mAvatar = new File(TEMP_IMG_PATH); if (mAvatar.exists()) mAvatar.delete(); mAvatarUri = Uri.fromFile(mAvatar); } }