안드로이드 개발 질문/답변
(글 수 45,052)
InputStream ins = getResources().openRawResource(R.raw.aa); int size; try { size = ins.available(); byte[] buffer = new byte[size]; ins.read(buffer); ins.close(); File file = new File("data/data/com.CallAppnResult/aaaa.ppt"); OutputStream ous = new FileOutputStream(file); ous.write(buffer); ous.close(); } catch (IOException e) { e.printStackTrace(); }
위와 같이 res/raw폴더에 있는 파일을 내부 메모리에다가 저장을 했습니다. 그리고 이 파일을
intent.setAction(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///data/data/com.CallAppnResult/aaaa.ppt"); intent.setDataAndType(uri, "application/vnd.ms-powerpoint"); startActivity(intent);
위와 같이 하여 실행을 하였는데 실행이 되지 않습니다.
sdcard에 저장하면 잘 되고요.ㅠㅠ 권한 문제이지 싶은데
안드로이드에서 같은 어플리케이션안에서는 내부 메모리에 있는 파일도 읽을 수 있는 줄 알았는데 어떻게 해결할 수 있을까요?