0

I'm new to android and java. I have read but fail to understand clear description of getResource and getPath method, maybe because I'm not getting the results as desired. getResource method is in java.lang.Class and is used to get url of resource object if resource is there. In my case, I'm always getting null no matter what! I'm getting null for whatever string I pass (obviously, I place corresponding resource in current java file directory)

this.getClass().getResource(String "---") always return null

and thus, getPath called on it gives null pointer exception. Is there an other way round? I'm developing android project. The java library I imported, uses this code to import config folder(xml configurations). What am i doing wrong? Please guide how paths are configured in java and android. (I'm using android studio as IDE)

krnbatta
  • 497
  • 5
  • 17
  • Android projects do not generally use Java resources. Does this library allow you to configure it by other means? If not, perhaps you might consider using some other library. – CommonsWare Aug 17 '15 at 18:34
  • Please read about classpath in a good java book / tutorial / here : http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html – Mrinal Aug 17 '15 at 18:35
  • http://stackoverflow.com/questions/625687/java-getclassloader-getresource-driving-me-bonkers/625712 – Maytham Fahmi Aug 17 '15 at 19:30

0 Answers0