Example usage for android.net RouteInfo RouteInfo

List of usage examples for android.net RouteInfo RouteInfo

Introduction

In this page you can find the example usage for android.net RouteInfo RouteInfo.

Prototype

public RouteInfo(@NonNull IpPrefix destination, @RouteType int type) 

Source Link

Usage

From source file:com.android.development.Connectivity.java

private void onAddDefaultRoute() {
    try {//from   w ww.  ja  v  a2  s  .  c o m
        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  .ja v a  2s. c  o 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());
    }
}