0

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.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
KOUSIK MANDAL
  • 2,002
  • 1
  • 21
  • 46

0 Answers0