Code example for URL

Methods: getContent

0
	public static Drawable loadImageFromUrl(String url) {
		URL m;
		InputStream i = null;
		Drawable d = null;
		try { 
			m = new URL(url);
			i = (InputStream) m.getContent();
 
			d = Drawable.createFromStream(i, "src");
		} catch (IOException e) {
			System.out.println("下载表情失败");
			return null; 
		} 
		return d;
	} 
 
	public static byte[] readGifFromUrl(String urls) {
		try { 
			URL url = new URL(urls);
			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
			conn.setDoInput(true);