Question: I want to use default camera and capture image. i want save image in sdcard/photofolder/ and save filename as curenttime format in sdcard/photofolder/ also display capture image in imageview page

```
Uri outputFileUri = Uri.fromFile("/sdcard/Photofolder/");    
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, CAMERA_REQUEST);

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
            if (requestCode == CAMERA_REQUEST) {  
                Bitmap photo = (Bitmap) data.getExtras().get("data"); 
               // imageView.setImageBitmap(photo);

                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inSampleSize = 4;
                Bitmap bitmap = BitmapFactory.decodeFile(picFileName, options);
                imageView.setImageBitmap(bitmap);
                imageView.setVisibility(View.VISIBLE);

            }  
        }

```

any idea about this ?? thanks in adavance

Answer: 
You can get SDCard path like..

```
String root = Environment.getExternalStorageDirectory().toString();

new File(root + "/photofolder").mkdirs();

```

Then you can save a file to `root + "/photofolder/20120830025700.jpg"`.

---

Have you requested permission to write onto SD card? Add the following string to you app manifest:

```
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

```
try using this in onActivityResult()

```
setupImage(photo);

```

and

```
public Bitmap setupImage(Intent data) { 
      BitmapFactory.Options options = new BitmapFactory.Options(); 
      options.inSampleSize = SAMPLE_SIZE;     // SAMPLE_SIZE = 2 

      Bitmap tempBitmap = null; 
      Bitmap bm = null; 
      try { 
       tempBitmap = (Bitmap) data.getExtras().get("data");
        bm = tempBitmap; 

        Log.v("ManageImage-hero", "the data.getData seems to be valid"); 

        FileOutputStream out = new FileOutputStream(outputFileUri.getPath()); 
        tempBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); 
      } catch (NullPointerException ex) { 
        Log.v("ManageImage-other", "another phone type"); 
        bm = otherImageProcessing(options); 
      } catch(Exception e) { 
        Log.v("ManageImage-setupImage", "problem setting up the image"+e); 
      } 

      return bm; 
    } 
private Bitmap otherImageProcessing(BitmapFactory.Options options) { 
      Bitmap bm = null; 

      try { 
        FileInputStream fis = new FileInputStream(outputFileUri.getPath()); 
        BufferedInputStream bis = new BufferedInputStream(fis); 
        bm = BitmapFactory.decodeStream(bis, null, options); 

        // cleaning up 
        fis.close(); 
        bis.close(); 
      } catch(Exception e) { 
        Log.e("ManageImage-otherImageProcessing", "Cannot load image", e); 
      } 

      return bm; 
    } 

```