Hi Murphy, I understand what you are saying and I know how to get 'resources' object from an Activity/Service. But I do not know how do we get in other context you said.
How can we get resources from non-Android code, I mean from ChallengeResponseV10.java which is a simple Java file? Sorry if I am asking a very basic question? Thanks On Feb 6, 2:27 pm, Mark Murphy <[email protected]> wrote: > Maddy wrote: > > I don't understand why getResourceAsStream() failed to load the file > > which is being present at the same directory level! > > I don't believe getResourceAsStream() necessarily works on Android. > > > Then I tried removing challenge.bin in this location and moved to res/ > > raw folder of my Android project, even then no luck! > > If you didn't change the code in the snippet you quoted, you will not > have any luck. > > > Please let me know if I have to change something to above code > > correctly pick the file. > > Try replacing: > > v10.getResourceAsStream(BIN_FILE) > > with: > > resources.openRawResource(R.raw.challenge) > > where: > > -- resources is a Resources object, typically obtained via calling > getResources() on an Activity, Service, or other Context > > -- you have put challenge.bin in res/raw/ > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
