List of usage examples for android.webkit URLUtil isHttpUrl
public static boolean isHttpUrl(String url)
From source file:com.shinymayhem.radiopresets.ServiceRadioPlayer.java
public static boolean validateUrl(String url) { if (!URLUtil.isHttpUrl(url) && !URLUtil.isHttpsUrl(url)) { //if (LOCAL_LOGV) log("not a valid http or https url", "v"); return false; }// ww w. j a va2s . c o m //check for empty after prefix if (url.equals("http://") || url.equals("https://")) { return false; } MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mediaPlayer.setDataSource(url); mediaPlayer.release(); } catch (IOException e) { return false; } return true; }