Java tutorial
//package com.java2s; import java.io.FileNotFoundException; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; import android.util.Log; public class Main { public static boolean isExists(String urlString) { try { URL u = new URL(urlString); HttpURLConnection huc = (HttpURLConnection) u.openConnection(); huc.setRequestMethod("GET"); huc.connect(); int rc = huc.getResponseCode(); return (rc == HttpURLConnection.HTTP_OK); // Handle response code here... } catch (UnknownHostException uhe) { // Handle exceptions as necessary Log.w("EPub", uhe.getMessage()); } catch (FileNotFoundException fnfe) { // Handle exceptions as necessary Log.w("EPub", fnfe.getMessage()); } catch (Exception e) { // Handle exceptions as necessary Log.w("EPub", e.getMessage()); } return false; } }