I have a file in the assets folder of my app. Is there any way I can use this file without having a context instance?
Asked
Active
Viewed 534 times
0
-
What do you want to do with that file ? – Chirag Aug 11 '12 at 04:07
-
2i think u can not use the asset folder with out context...u can just pass your context as parameter in class construcor – Jackson Chengalai Aug 11 '12 at 04:10
-
As the other answers/comments pointed out you need a context-instance. However Activity, Service, broadcastlister and many other classes inherit from context so you can use these as context. – k3b Aug 11 '12 at 06:24
1 Answers
0
Nope you need a context. Note that you should always have access to a context in your app except under some static contexts. As another poster pointed out, if you require context access from within utility classes/methods, you simply need to make Context a parameter of the method(s).

Nick
- 8,181
- 4
- 38
- 63