문제

I am trying to open a Resource by passing the result of context.getResources().getString(R.drawable.myimage) to another class that is not an activity. context.getResources().getString(R.drawable.myimage) returns res/drawable-mdpi/myimage.png However, when I try and open this file, it throws a FileNotFoundException.

What is the proper way to open a resource outside an activity?

도움이 되었습니까?

해결책

Can you post the code where you try to open the file.

res/drawable-mdpi/myimage.png is a relative path, not an absolute one. I guess you're not opening the correct path by using the relative and not absolute path.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top