Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>first: </p> <pre><code> Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); </code></pre> <p>second the hard work. <code>onActivityResult</code></p> <pre><code> (requestCode == CAMERA_PIC_REQUEST) { imageFileUri = intent.getData(); bmp = (Bitmap) intent.getExtras().get("data"); view.setImageBitmap(bmp); view.setImageBitmap(bmp);// its weird i know but it wont work if not like this :D if (imageFileUri != null) { imageFileUri = intent.getData(); bmp = (Bitmap) intent.getExtras().get("data"); view.setImageBitmap(bmp); } else { // Describe the columns you'd like to have returned. // Selecting from the Thumbnails location gives you both the // Thumbnail Image ID, as well as the original image ID String[] projection = { MediaStore.Images.Thumbnails._ID, // The columns we wANT MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Thumbnails.KIND, MediaStore.Images.Thumbnails.DATA }; String selection = MediaStore.Images.Thumbnails.KIND + "=" + // Select // only // mini's MediaStore.Images.Thumbnails.MINI_KIND; String sort = MediaStore.Images.Thumbnails._ID + " DESC"; // At the moment, this is a bit of a hack, as I'm returning // ALL images, and just taking the latest one. There is a // better way to narrow this down I think with a WHERE // clause which is currently the selection variable Cursor myCursor = this.managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, selection, null, sort); long imageId = 0l; long thumbnailImageId = 0l; @SuppressWarnings("unused") String thumbnailPath = ""; try { myCursor.moveToFirst(); imageId = myCursor.getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.IMAGE_ID)); thumbnailImageId = myCursor.getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID)); thumbnailPath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA)); } finally { myCursor.close(); } // Create new Cursor to obtain the file Path for the large // image String[] largeFileProjection = { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA }; String largeFileSort = MediaStore.Images.ImageColumns._ID + " DESC"; myCursor = this.managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, largeFileProjection, null, null, largeFileSort); @SuppressWarnings("unused") String largeImagePath = ""; try { myCursor.moveToFirst(); // This will actually give yo uthe file path location of // the image. largeImagePath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATA)); } finally { myCursor.close(); } // These are the two URI's you'll be interested in. They // give you a handle to the actual images Uri uriLargeImage = Uri.withAppendedPath( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, String.valueOf(imageId)); @SuppressWarnings("unused") Uri uriThumbnailImage = Uri.withAppendedPath( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, String.valueOf(thumbnailImageId)); imageFileUri = uriLargeImage; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload