Code example for URLConnection

Methods: getInputStream, setRequestProperty

0
        reader.setContentHandler(this);
        reader.setErrorHandler(this);
 
        final URL url = new URL(mUrl);
        final URLConnection c = url.openConnection();
        c.setRequestProperty("User-Agent", "Android/1.5");
 
        reader.parse(new InputSource(c.getInputStream()));
 
        return mId;
    } 
 
    public boolean updateFavicon(long id, String iconUrl) throws MalformedURLException {
        return updateFavicon(id, new URL(iconUrl));
    } 
 
    public boolean updateFavicon(long id, URL url) {
        InputStream stream = null;
        OutputStream ico = null;
        boolean r = false;