URL 파일 확인.

Android 2016. 1. 12. 14:43
	
private boolean isExist(String url)
	{
		try {
			URLConnection con = new URL(url).openConnection();
			HttpURLConnection urlCon = (HttpURLConnection)con;
			urlCon.setRequestMethod("HEAD");
			urlCon.setFollowRedirects(false);
			int rescode = urlCon.getResponseCode() ;
			if ( rescode == 200 ) { 
				return true;
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
		}
		return false; 
	}

'Android' 카테고리의 다른 글

동영상 캡쳐. Using ADB  (0) 2016.03.30
GridLayout  (0) 2015.07.06
webpage interface  (0) 2014.12.22
Android Eclipse - Could not find *.apk  (0) 2014.12.10
android case expressions must be constant expressions  (0) 2014.12.10
Posted by iRang1101
,