I have an Activity that can take a picture. That works. However, I have no clue how I can get these picture (not the thumbnail).
I read the articles from Android Developer and this way does not work.
My Code:
public class CreateOfferActivity extends ActionBarActivity {
private static final int REQUEST_IMAGE_CAPTURE = 1, REQUEST_TAKE_PHOTO = 1, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100;
private ImageView imgView;
private Button btncreate;
private EditText crttitle, crtdescription, crtprice, crtISBN, crtname, crtemail, crtphone, crttags;
private File picFile;
private Bitmap bit;
private Database1 db;
@Override
protected void onCreate(Bundle savedInstanceState) {
     ...
    imgView = (ImageView) findViewById(R.id.img_view);
    imgView.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v) {
            try {
                Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                picFile = File.createTempFile("pic_", ""+System.nanoTime(), getCacheDir() );
                i.putExtra(MediaStore.EXTRA_OUTPUT, picFile.getAbsolutePath() );
                startActivityForResult(i, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    setPic();
}
private void saveData(){
    ...
}
private void setPic() {
    if(picFile != null) {
        // Get the dimensions of the View
        int targetW = imgView.getWidth();
        int targetH = imgView.getHeight();
        // Get the dimensions of the bitmap
        BitmapFactory.Options bmOptions = new BitmapFactory.Options();
        bmOptions.inJustDecodeBounds = true;
        BitmapFactory.decodeFile("file:" + picFile.getAbsolutePath(), bmOptions);
        int photoW = bmOptions.outWidth;
        int photoH = bmOptions.outHeight;
        // Determine how much to scale down the image
        int scaleFactor = Math.min(photoW / targetW, photoH / targetH);
        // Decode the image file into a Bitmap sized to fill the View
        bmOptions.inJustDecodeBounds = false;
        bmOptions.inSampleSize = scaleFactor;
        bmOptions.inPurgeable = true;
        bit = BitmapFactory.decodeFile("file:" + picFile.getAbsolutePath(), bmOptions);
        imgView.setImageDrawable(new BitmapDrawable(bit));
    }
}
If I run the code, I get this:
Unable to decode stream: java.io.FileNotFoundException: file:/data/data/com.example.leible.appproject/cache/pic_-49734472888666069621067: open failed: ENOENT (No such file or directory)
The permissions in the manifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
Can someone help me, please?