Back to project page ScalAR.
The source code is released under:
GNU General Public License
If you think the Android project ScalAR listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package edu.dhbw.andobjviewer.util; /*from w w w.ja v a2 s. c o m*/ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class AssetsFileUtil extends BaseFileUtil { private AssetManager am; public AssetsFileUtil(AssetManager am) { this.am = am; } @Override public Bitmap getBitmapFromName(String name) { InputStream is = getInputStreamFromName(name); return (is==null)?null:BitmapFactory.decodeStream(is); } @Override public BufferedReader getReaderFromName(String name) { InputStream is = getInputStreamFromName(name); return (is==null)?null:new BufferedReader(new InputStreamReader(is)); } private InputStream getInputStreamFromName(String name) { InputStream is; if(baseFolder != null) { try { is = am.open(baseFolder+name); } catch (IOException e) { e.printStackTrace(); return null; } } else { try { is = am.open(name); } catch (IOException e) { e.printStackTrace(); return null; } } return is; } }