Открытие jpeg после сохранения

Хотелось бы открыть созданное jpg изображение, файл создается, а просмотр не запускается

 private void openImage(File files) {
    File file = new File( files.getParent()+files.getName());
    if (file.exists()) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.fromFile(file);
        intent.setDataAndType(uri,".jpg");
        intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, "Не найдено приложение для просмотра JPEG файлов", Toast.LENGTH_SHORT).show();
        }
    }
}

Ответы (0 шт):