I have a requirement to read a text or image file via java in android. The text and image file is in the same directory of a sub directory inside a java package, like;
handler <---- Package
MyClass.java
-----/imgs
---------/test.jpg
Now how to get access of test.jpg
file?
I tried;
URL url = OneOfYourClass.class.getResource("handler/imgs/test.jpg");
And
URL path = ClassLoader.getSystemResource("imgs/test.png");
None of those worked. Is it permission issue? Does images goes with the apk when I installed the app? Or I am doing wrong something?
I tried for an hours, any help will be great for me.