List of usage examples for android.content Context getAssets
public abstract AssetManager getAssets();
From source file:Main.java
private static InputStream trustedCertificatesInputStream(Context context, String assetsFileName) { try {/*www. ja v a 2 s .com*/ return context.getAssets().open(assetsFileName); } catch (Exception var3) { return null; } }
From source file:Main.java
public static Bitmap loadBitmapFromAsset(Context context, String path) throws IOException { InputStream ims = context.getAssets().open(path); return BitmapFactory.decodeStream(ims); }
From source file:Main.java
public static List<String> loadBusList(Context context) throws IOException { InputStream is = context.getAssets().open("list.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); List<String> list = new ArrayList<String>(); String line;/* w w w. ja v a2 s .c o m*/ while ((line = br.readLine()) != null) { list.add(line); } br.close(); return list; }
From source file:Main.java
public static final InputStream read(Context context, String path) { AssetManager assetManager = context.getAssets(); InputStream inputStream = null; try {//from w ww.j a va 2 s .c o m inputStream = assetManager.open(path); } catch (IOException e) { } return inputStream; }
From source file:Main.java
public static Typeface getTypeFace(Context context, String typefaceName) { return Typeface.createFromAsset(context.getAssets(), typefaceName); }
From source file:Main.java
public static Typeface getTypeFace(Context context, String typeFace) { Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/" + typeFace); return tf;/*w w w . j a va2s .c o m*/ }
From source file:Main.java
public static void setLightFontFamily(Context context, TextView view) { Typeface tf = Typeface.createFromAsset(context.getAssets(), "Gill Sans/Gill Sans MT Light.ttf"); view.setTypeface(tf);/*from w ww . j a va 2 s. co m*/ }
From source file:Main.java
public static Typeface getCustomTypeFace(Context context) { Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/regular.otf"); return tf;/*from w ww . java2 s . c om*/ }
From source file:Main.java
public static Drawable loadDrawableFromAsset(Context context, String path) throws IOException { InputStream ims = context.getAssets().open(path); // load image as Drawable Drawable d = Drawable.createFromStream(ims, null); return d;//from ww w . j ava 2 s . co m }
From source file:Main.java
public static InputStream getInputStreamForName(Context context, String fileName) { AssetManager assetManager = context.getAssets(); InputStream inputStream = null; try {/* w ww. j av a 2 s . co m*/ inputStream = assetManager.open(fileName); } catch (IOException e) { e.printStackTrace(); } return inputStream; }