I looked at the 2 examples on Stack, but can\'t get them to work. I\'m simply trying to grab an image from a folder in assets and set it as in ImageView, but get a null pointer
Where is "file:///android_asset/Samples/" + imageName
coming from? If your hierarchy looks like assets/file_name.jpg, you would just call open(file_name.jpg)
. In other words, try replacing your file:///android_asset/Samples/" + imageName
with just imageName
.
Check out the API Demos, specifically the ReadAsset.java class:
try {
InputStream is = getAssets().open("read_asset.txt");
...
where the assets folder looks like