i am using Aide and its giving me this strange error on openInputStream:
The Exception 'java.io.FileNotFoundException' must be caught or declared in the throws clause
my code:
case R.id.album:
intent = new Intent("android.intent.action.GET_CONTENT");
intent.setType("image/*");
startActivityForResult(intent, R.id.album);
break;
case R.id.camera:
intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra("output", Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "camera.jpg")));
startActivityForResult(intent, R.id.camera);
break;
protected void onActivityResult(int request, int result, Intent data) {
switch (request) {
case R.id.album:
if (result == -1) {
this.paintView.setPicture(BitmapFactory.decodeStream(getContentResolver().openInputStream(data.getData())));
}
case R.id.camera:
if (result == -1) {
try {
File file = new File(Environment.getExternalStorageDirectory(), "camera.jpg");
this.paintView.setPicture(BitmapFactory.decodeFile(file.toString()));
file.delete();
} catch (Exception e) {
}
}
i didnt find anything wrong in my code maybe Aide needs more code or its not support this kind of code. i tried to figure it out from other questions similiar to this but i found nothing. is there any replace for the code?