Java Code Examples for android.graphics.drawable.Drawable#createFromResourceStream()
The following examples show how to use
android.graphics.drawable.Drawable#createFromResourceStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceManager.java From letv with Apache License 2.0 | 5 votes |
private static Drawable extractDrawable(Context context, String fileName) throws Exception { InputStream inputStream = context.getAssets().open(fileName); DisplayMetrics dm = context.getResources().getDisplayMetrics(); TypedValue value = new TypedValue(); value.density = dm.densityDpi; Drawable drawable = Drawable.createFromResourceStream(context.getResources(), value, inputStream, fileName); inputStream.close(); return drawable; }
Example 2
Source File: ResourceManager.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
private static Drawable extractDrawable(Context context, String s) { InputStream inputstream = context.getAssets().open(s); DisplayMetrics displaymetrics = context.getResources().getDisplayMetrics(); TypedValue typedvalue = new TypedValue(); typedvalue.density = displaymetrics.densityDpi; Drawable drawable = Drawable.createFromResourceStream(context.getResources(), typedvalue, inputstream, s); inputstream.close(); return drawable; }
Example 3
Source File: UrlImageGetter.java From android-discourse with Apache License 2.0 | 5 votes |
/** * Get the Drawable from URL * * @param urlString * @return */ public Drawable fetchDrawable(String urlString) { try { InputStream is = fetch(urlString); Drawable drawable = Drawable.createFromResourceStream(App.getContext().getResources(), null, is, "src"); L.d("%d----------X------ %d--%s", drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), urlString); drawable.setBounds(0, 0, 0 + drawable.getIntrinsicWidth(), 0 + drawable.getIntrinsicHeight()); return drawable; } catch (Exception e) { return null; } }
Example 4
Source File: LollipopDrawablesCompat.java From Carbon with Apache License 2.0 | 2 votes |
/** * Create a drawable from an inputstream, using the given resources and value to determine * density information. */ public static Drawable createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName, BitmapFactory.Options opts) { return Drawable.createFromResourceStream(res, value, is, srcName, opts); }
Example 5
Source File: LollipopDrawablesCompat.java From RippleDrawable with MIT License | 2 votes |
/** * Create a drawable from an inputstream, using the given resources and * value to determine density information. */ public static Drawable createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName, BitmapFactory.Options opts) { return Drawable.createFromResourceStream(res, value, is, srcName, opts); }