Итак, я сфотографируюсь, и после этого я пытаюсь сохранить его на этом пути, но я не могу получить к нему доступ. Попробовал это < /users-permission> < /code> и не работал.private void takePic(View v)
{
// se usa para usar algun app del phone para usar sus cosas para hacer lo que queremos envez de crearlo from scratch
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
//guarda la imagen
File imgFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),"pic.jpg");
imgUri = Uri.fromFile(imgFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imgUri);
//le dice que use el app de camare y le dice que use la camara de atras 1 = la de atras
startActivityForResult(intent, TAKE_PICTURE);
}
//hay que hacerle override para que haga algo que no es parte del metedo.
//Por ejemplo quiero que guarde la imagen donde yo quiera y no donde tiene por default.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
{
super.onActivityResult(requestCode, resultCode, intent);
//si presiono el buton de ok
if(resultCode == Activity.RESULT_OK)
{
Uri selectedImg = imgUri;
// te deja saber que termino de usar la imagen
getContentResolver().notifyChange(selectedImg, null);
ImageView imgV = (ImageView)findViewById(R.id.SteerinRackImgVw);
// lo mismo de horita
ContentResolver cR = getContentResolver();
//tiene la data de la img
Bitmap btMp;
try
{
btMp = MediaStore.Images.Media.getBitmap(cR, selectedImg);
imgV.setImageBitmap(btMp);
//display a small popup de lo que esta pasando
Toast.makeText(TestMain.this,selectedImg.toString(), Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Log.e("error", e.toString());
}
}
}
< /code>
Надеюсь, я не пропустил каких -либо скобков: p < /p>
Когда я отлаживаю блок попытки поймать, программа выходит из попытки, на 1 -й строке. < /p>
Я надеюсь, что это имеет смысл. Английский не мой основной язык. Любая помощь будет очень оценена.
Подробнее здесь: https://stackoverflow.com/questions/262 ... led-eacces
FilenotFoundException: /storage/emultion/0/pictures/pic.jpg: Open Faile: eacces (разрешение отказано) ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение