Android examples for android.graphics:Image Load Save
get Image Capture Intent
import java.io.File; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; public class Main { public static final boolean HAS_IMAGE_CAPTURE_BUG = false; private static final String TMP_SD_LOCATION_JPG = "abc.jpg"; /**//from ww w. ja va 2 s. co m * The result of this should be handled by * {@link #handleImageCaptureResult(Context, Intent)} to return a URI pointing * to the image. * * @return an intent that should be used with * {@link Activity#startActivityForResult(Intent, int)}. */ public static Intent getImageCaptureIntent(File destination) { final Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); if (HAS_IMAGE_CAPTURE_BUG) { final File tmpfile = new File(TMP_SD_LOCATION_JPG); tmpfile.getParentFile().mkdirs(); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TMP_SD_LOCATION_JPG))); } else { i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(destination, System.currentTimeMillis() + ".jpg"))); } return i; } private static boolean hasImageCaptureBug() { final ArrayList<String> devices = new ArrayList<String>(); // list of known devices that have the bug devices.add("android-devphone1/dream_devphone/dream"); devices.add("generic/sdk/generic"); devices.add("vodafone/vfpioneer/sapphire"); devices.add("tmobile/kila/dream"); devices.add("verizon/voles/sholes"); devices.add("google_ion/google_ion/sapphire"); final String devstring = android.os.Build.BRAND + "/" + android.os.Build.PRODUCT + "/" + android.os.Build.DEVICE; Log.d(TAG, "device string: " + devstring); return devices.contains(devstring); } }