Android examples for java.net:URL
Read from URL
import android.graphics.Color; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.style.ForegroundColorSpan; import android.widget.TextView; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String getWebCon(String domain) { StringBuffer sb = new StringBuffer(); try {/*from w ww . j a va 2 s .c o m*/ java.net.URL url = new java.net.URL(domain); BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream())); String line; while ((line = in.readLine()) != null) { sb.append(line); } in.close(); } catch (Exception e) { sb.append(e.toString()); System.err.println(e); } return sb.toString(); } }