Java tutorial
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; public class Main { private static TelephonyManager telephonyManager = null; public static String getSimCode(Context con) { if (getTelephonyManager(con).getSimState() == 5) { String code = getTelephonyManager(con).getSimOperator(); return code != null ? code : ""; } else { return ""; } } private static TelephonyManager getTelephonyManager(Context con) { if (telephonyManager == null) { telephonyManager = (TelephonyManager) con.getSystemService(Context.TELEPHONY_SERVICE); return telephonyManager; } else { return telephonyManager; } } }