Note that there are some explanatory texts on larger screens.

plurals
  1. POSave photo to memory card instead of local
    primarykey
    data
    text
    <p>I have the following code taking a picture and saving it. But I want to save the final image to SD card instead.</p> <pre><code>public class TakePhoto extends Activity { ImageView iv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_take_photo); iv = (ImageView) findViewById(R.id.imageView1); Button b = (Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 0); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); Bitmap bm = (Bitmap) data.getExtras().get("data"); writeBitmapToMemory("image.png", bm); iv.setImageBitmap(bm); } public void writeBitmapToMemory(String filename, Bitmap bitmap) { FileOutputStream fos; try { fos = this.openFileOutput(filename, Context.MODE_PRIVATE); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } </code></pre> <p>Theres one bit that seems to be playing up. I'm trying to save to SD card but it falls over with an error: (pastebin.com/FHihS4Wv) </p> <p>I changed <code>writeBitmapToMemory("/mnt/extSdCard/image.png", bm);</code>on my onActivityResult – But it falls over with the pastebinned error above</p>
    singulars
    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.
 

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