List of usage examples for android.net NetworkUtils numericToInetAddress
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) @Deprecated public static InetAddress numericToInetAddress(String addrString) throws IllegalArgumentException
From source file:android.net.Proxy.java
private static final boolean isLocalHost(String host) { if (host == null) { return false; }/*from ww w . j a v a 2 s .c o m*/ try { if (host != null) { if (host.equalsIgnoreCase("localhost")) { return true; } if (NetworkUtils.numericToInetAddress(host).isLoopbackAddress()) { return true; } } } catch (IllegalArgumentException iex) { } return false; }
From source file:com.android.development.Connectivity.java
private void onAddDefaultRoute() { try {//from w ww .j av a 2 s . c om int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString()); mNetd.addRoute(netId, new RouteInfo((LinkAddress) null, NetworkUtils.numericToInetAddress("8.8.8.8"))); } catch (Exception e) { Log.e(TAG, "onAddDefaultRoute got exception: " + e.toString()); } }
From source file:com.android.development.Connectivity.java
private void onRemoveDefaultRoute() { try {// ww w . j a v a 2 s . co m int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString()); mNetd.removeRoute(netId, new RouteInfo((LinkAddress) null, NetworkUtils.numericToInetAddress("8.8.8.8"))); } catch (Exception e) { Log.e(TAG, "onRemoveDefaultRoute got exception: " + e.toString()); } }