Back to project page androidtool.
The source code is released under:
MIT License
If you think the Android project androidtool listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.chris.android.tool.mobiledata; // w w w .j a va 2 s .c o m import android.telephony.TelephonyManager; import android.util.SparseArray; import org.chris.android.tool.R; public enum DataConnectionState { DISCONNECTED(TelephonyManager.DATA_DISCONNECTED, R.string.mobile_data_state_disconnected, false), CONNECTED( TelephonyManager.DATA_CONNECTED, R.string.mobile_data_state_connected, true), CONNECTING( TelephonyManager.DATA_CONNECTING, R.string.mobile_data_state_connecting, true), SUSPENDED( TelephonyManager.DATA_SUSPENDED, R.string.mobile_data_state_suspended, true); private final int state; private final static SparseArray<DataConnectionState> states = new SparseArray<>(); private final boolean connected; private final int labelTextId; static { for (DataConnectionState val : values()) { states.put(val.state, val); } } private DataConnectionState(int state, int labelTextId, boolean connected) { this.state = state; this.labelTextId = labelTextId; this.connected = connected; } public static DataConnectionState forId(int id) { return states.get(id); } public boolean isConnected() { return connected; } public int getLabelTextId() { return labelTextId; } }