List of usage examples for android.graphics.drawable Drawable createFromStream
public static Drawable createFromStream(InputStream is, String srcName)
From source file:Main.java
public static Drawable getDrawableFromUrl(String url) throws Exception { return Drawable.createFromStream(getRequest(url), null); }
From source file:Main.java
public static Drawable getDrawableByByte(byte[] bts) { ByteArrayInputStream baInputStream = new ByteArrayInputStream(bts); return Drawable.createFromStream(baInputStream, "img"); }
From source file:Main.java
public static Drawable LoadImageFromWebOperations(String url) { try {//from w ww .ja v a2 s .c om InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; } catch (Exception e) { return null; } }
From source file:Main.java
public static Drawable byteToDrawable(byte[] byteArray) { ByteArrayInputStream ins = null; if (byteArray != null) ins = new ByteArrayInputStream(byteArray); return Drawable.createFromStream(ins, null); }
From source file:Main.java
public static Drawable byteToDrawable(byte[] byteArray) { ByteArrayInputStream ins = null; if (byteArray != null) { ins = new ByteArrayInputStream(byteArray); }//w w w . ja v a 2s . co m return Drawable.createFromStream(ins, null); }
From source file:Main.java
public static Drawable loadImage(String name, AssetManager assetManager) { try {//from w ww . j a v a 2s . c o m InputStream ims = assetManager.open(name); return Drawable.createFromStream(ims, null); } catch (IOException ex) { //throw new RuntimeException( "Image " + name + " could not be loaded" ); return null; } }
From source file:Main.java
public static Drawable loadImageFromURL(String url) { Drawable drawable = null;/*from w w w . j av a 2 s. c o m*/ try { InputStream is = (InputStream) new URL(url).getContent(); drawable = Drawable.createFromStream(is, "srcname"); } catch (IOException e) { e.printStackTrace(); } return drawable; }
From source file:Main.java
/** * get Drawable from assert/*ww w. jav a 2 s . c o m*/ * * @param context * @param fileName * @return */ public static Drawable getDrawableFromAssets(Context context, String fileName) { try { return Drawable.createFromStream(context.getAssets().open(fileName), fileName); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static Drawable getDrawableFromUri(Uri uri, Context context) throws FileNotFoundException { InputStream inputStream = context.getContentResolver().openInputStream(uri); return Drawable.createFromStream(inputStream, uri.toString()); }
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;// www. j a v a2 s . c o m }