Java tutorial
//package com.java2s; import android.os.Environment; import java.io.File; import java.io.IOException; public class Main { public static File getTempImage() throws IOException { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File tempFile = new File(Environment.getExternalStorageDirectory(), "temp.jpg"); tempFile.createNewFile(); return tempFile; } throw new IOException("cannot find any sdcard."); } }