Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ok geetanjali. try this code this will open gallery and you can pick a photo to crop, it will store with name starts from apple, you can see cropped image in your activity </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); photoPickerIntent.putExtra("crop","true"); photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempFile()); photoPickerIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); startActivityForResult(photoPickerIntent, 1); } private Uri getTempFile() { if (isSDCARDMounted()) { String f; muri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "apple_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); //File f = new File(Environment.getExternalStorageDirectory(),"titus1.jpg"); try { f=muri.getPath(); } catch (Exception e) { } return muri; } else { return null; } } private boolean isSDCARDMounted(){ String status = Environment.getExternalStorageState(); if (status.equals(Environment.MEDIA_MOUNTED)) return true; return false; } protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch (requestCode) { case 1: if (resultCode == RESULT_OK) { String filePath= muri.getPath(); Log.e("path", "filePath"); Toast.makeText(this, filePath, Toast.LENGTH_LONG).show(); Bitmap selectedImage = BitmapFactory.decodeFile(filePath); image = (ImageView)findViewById(R.id.image); image.setImageBitmap(selectedImage); } } } </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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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