Loading a file from res folder in android test project -


In a test case I must load the picture that is available in the folder in my test project

  / myproject / res / drawable-hdpi / attachment.png  

I used it by using InstrumentationTestCase and before saving the file in the / res / raw folder and loading it with it I have tried, but my attachment in the R file is not enclosed.

  Reference test consensus = getInstrumentation (). GetContext (); InputStream input = testContext.getResources (). OpenRawResource (R.raw.exe)  

Any ideas?

Thanks

You should not use raw, used to save pictures Known asset;)


Comments

Popular posts from this blog

c# - Highlight all words containing a letter in a richtextbox -

Admob interstitials not clickable on Nexus 5 (Android 4.4.2) -

java - MigLayout - selective component fill -