I've been trying to access images from my assets folder now instead of drawable in order to possibly alleviate some memory issues I'm having.
I found this code to aid with this:
public static Drawable getAssetImage(Context context, String filename) throws IOException {
AssetManager assets = context.getResources().getAssets();
InputStream buffer = new BufferedInputStream((assets.open("drawable/" + filename + ".png")));
Bitmap bitmap = BitmapFactory.decodeStream(buffer);
return new BitmapDrawable(context.getResources(), bitmap);
}
I'm confused what the context is though. Am I to pass it my MainActivity.java? Or reference it to a specific view? If anyone could explain this I would much appreciate it.