Refine search
public static Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; } catch (Exception e) { return null; } }
try { ImageView i = (ImageView)findViewById(R.id.image); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent()); i.setImageBitmap(bitmap); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
ImageView iv = new ImageView; URL url = new URL(address); InputStream content = (InputStream)url.getContent(); Drawable d = Drawable.createFromStream(content , "src"); iv.setImageDrawable(d)
public static Bitmap loadImageFromNetwork(String url) { Bitmap bitmap = null; try { bitmap = BitmapFactory.decodeStream((InputStream) new URL(url) .getContent()); } catch (Exception e) { e.printStackTrace(); } return bitmap; }
System.out.println((new URL("http://pastebin.com/pastebin.php?dl=f722c7eb0")).getContent())
java.net.URL finalUrl; try { finalUrl = new java.net.URL( uri.toString() ); } catch ( MalformedURLException e ) { e.printStackTrace(); return (InputStream) finalUrl.getContent(); } catch ( IOException e ) { e.printStackTrace();
try { bitmap = BitmapFactory.decodeStream((InputStream) new URL(url).getContent()); } catch (Exception e) { e.printStackTrace();
/** * getContent from 169.254.169.254. */ @BeforeTest(groups = {"aws"}) public void checkEc2() throws Exception { URL testEc2Url = new URL("http://169.254.169.254/latest/meta-data"); testEc2Url.getContent(); }
@Test(enabled = false) public void mustDownloadLargeFiles() throws Exception { mockServer.when(HttpRequest.request().withMethod("CONNECT").withPath("www.us.apache.org:80")) .respond(HttpResponse.response().withStatusCode(200)); mockServer.when(HttpRequest.request().withMethod("GET") .withPath("/dist//httpcomponents/httpclient/binary/httpcomponents-client-4.5.1-bin.tar.gz")) .forward(HttpForward.forward().withHost("www.us.apache.org").withPort(80)); Tunnel tunnel = Tunnel.build("www.us.apache.org", 80, "localhost", PORT); try { IOUtils.copyLarge((InputStream) new URL("http://localhost:" + tunnel.getPort() + "/dist//httpcomponents/httpclient/binary/httpcomponents-client-4.5.1-bin.tar.gz") .getContent(new Class[]{InputStream.class}), new FileOutputStream(File.createTempFile("httpcomponents-client-4.5.1-bin", "tar.gz"))); } finally { tunnel.close(); } }
try { ImageView i = (ImageView)findViewById(R.id.image); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent()); i.setImageBitmap(bitmap); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
/** * Function loads the users facebook profile pic * * @param userID */ public Bitmap getUserPic(String userID) { String imageURL; Bitmap bitmap = null; Log.d(TAG, "Loading Picture"); imageURL = "http://graph.facebook.com/"+userID+"/picture?type=small"; try { bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent()); } catch (Exception e) { Log.d("TAG", "Loading Picture FAILED"); e.printStackTrace(); } return bitmap; }
ImageView image = (ImageView)findViewById(R.id.image); if(!ImageUrl.equals("no image")) { try { image.setImageDrawable(grabImageFromUrl(ImageUrl)); } catch(Exception e) { } } private Drawable grabImageFromUrl(String url) throws Exception { return Drawable.createFromStream((InputStream)new URL(url).getContent(), "src"); }
public void run() { try { final Bitmap bitmap = BitmapFactory .decodeStream((InputStream) new URL(imgurl) .getContent()); mImageView.post(new Runnable() { @Override public void run() { if (bitmap != null) { mImageView.setImageBitmap(bitmap); } } }); } catch (Exception e) { e.printStackTrace(); } } }).start();
public void run() { try { final Bitmap bitmap = BitmapFactory .decodeStream((InputStream) new URL(imgurl) .getContent()); mImageView.post(new Runnable() { @Override public void run() { if (bitmap != null) { mImageView.setImageBitmap(bitmap); } } }); } catch (Exception e) { e.printStackTrace(); } } }).start();
URL u = new URL("file:/"+System.getProperty("user.dir")); PlainTextInputStream in = (PlainTextInputStream)u.getContent();
remote_picture = BitmapFactory.decodeStream((InputStream) new URL(intent.getExtras().getString("imageurl")).getContent()); } catch (IOException e) { e.printStackTrace();
public Drawable loadImageFromURL(String url, String name) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, name); return d; } catch (Exception e) { return null; } }
titleTv.setText(title); contentTv.setText(content); try { //where imageUrl is what you pulled out from the rss feed Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent()); image.setImageBitmap(bitmap); } catch (MalformedURLException e) { //log exception here } catch (IOException e) { //log exception here }
public void run() { try { URL url = new URL(this.uri); url.getContent(); } catch (Exception ignore) { } } }
@Override public Drawable getDrawable(String url) { Drawable drawable = Drawable.createFromStream((InputStream) new URL(url).getContent(), null); final float scalingFactor = (float)textView.getMeasuredWidth() / d.getIntrinsicWidth(); d.setBounds(0, 0, textView.getMeasuredWidth(), (int) (d.getIntrinsicHeight()*scalingFactor)); }