Example usage for android.telephony TelephonyManager from

List of usage examples for android.telephony TelephonyManager from

Introduction

In this page you can find the example usage for android.telephony TelephonyManager from.

Prototype

@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static TelephonyManager from(Context context) 

Source Link

Usage

From source file:com.android.settings.datausage.CellDataPreference.java

@Override
protected void onRestoreInstanceState(Parcelable s) {
    CellDataState state = (CellDataState) s;
    super.onRestoreInstanceState(state.getSuperState());
    mTelephonyManager = TelephonyManager.from(getContext());
    mChecked = state.mChecked;//from   www .j  a  v a  2 s .c o m
    mMultiSimDialog = state.mMultiSimDialog;
    if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        mSubId = state.mSubId;
        setKey(getKey() + mSubId);
    }
    notifyChanged();
}

From source file:com.android.settings.datausage.CellDataPreference.java

@Override
public void setTemplate(NetworkTemplate template, int subId, NetworkServices services) {
    if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        throw new IllegalArgumentException("CellDataPreference needs a SubscriptionInfo");
    }/*from w w w .  ja  v  a  2  s.c  o  m*/
    mSubscriptionManager = SubscriptionManager.from(getContext());
    mTelephonyManager = TelephonyManager.from(getContext());
    if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        mSubId = subId;
        setKey(getKey() + subId);
    }
    updateChecked();
}