如果双 SIM 卡槽之一的 SIM 卡发生更改,如何检索该卡的信息?

2024-03-14

我知道我们可以使用 TelephonyManager 类检索单张 Sim 卡的信息。但如何检索多张SIM卡的信息呢?假设我的手机丢失了,有人更换了其中一个插槽中的 SIM 卡。我如何接收 IMEI 号码、电话号码等信息?我只在更换 Sim 卡时才需要这些信息。

在 TelephonyManager 类中,有直接方法来检索这些信息(如 IMEI 号码、电话号码、电话网络类型等),但这些信息仅适用于一张 Sim 卡。如何接收有关多张 SIM 卡的所有信息。 P.S-SubscriptionManager 类没有像 TelephonyManager 类那样的直接方法。

    import android.content.Context;
        import android.support.v7.app.AppCompatActivity;
        import android.os.Bundle;
        import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.widget.TextView;

import java.util.List;

import static android.R.id.content;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        int subID,simposition,content;
        String carrier,number;
        TextView textView2=(TextView)findViewById(R.id.text);
        SubscriptionManager subManager=(SubscriptionManager)getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);

        List<SubscriptionInfo> subInfoList=subManager.getActiveSubscriptionInfoList();

        for(int i=0;i<subInfoList.size();i++)
        {
           subID = subInfoList.get(i).getSubscriptionId();
            simposition = subInfoList.get(i).getSimSlotIndex();
             content=subInfoList.get(i).describeContents();
          carrier= (String) subInfoList.get(i).getCarrierName();
            number= subInfoList.get(i).getNumber();
        }

       /* String info2="Sim Details:\n";
        info2+="\n SubId:"+subID;
        info2+="\n Sim position:"+simposition;
        info2+="\n contents:"+content;
        info2+="\n carrier:"+carrier;
        info2+="\n number:"+number;
        textView2.setText(info2);*/
    }
}

您可以使用此工作示例代码来解决您的问题。

参考链接:https://github.com/ITger/DualSIMCard https://github.com/ITger/DualSIMCard

类中的示例代码:https://github.com/ITger/DualSIMCard/blob/master/dualSIMcardReader/src/main/java/pl/itger/dualsimcard/TelInfo.java https://github.com/ITger/DualSIMCard/blob/master/dualSIMcardReader/src/main/java/pl/itger/dualsimcard/TelInfo.java

    /**
     * Created by piotrz on 7/23/15.
     * Copyright 2015 Piotr Zerynger ITger
     */

    import android.content.Context;
    import android.telephony.CellInfo;
    import android.telephony.TelephonyManager;
    import android.telephony.gsm.GsmCellLocation;

    import java.lang.reflect.Method;
    import java.util.ArrayList;
    import java.util.List;

    import static pl.itger.dualsimcard.MainActivity.getMActContext;

    public final class TelInfo {

        private static TelInfo telInf;
        protected Sci[] scitems;
        ArrayList<Sci> scitemsArr;
        //private String imsiSIM1;
        private String imsiSIM2;
        private boolean isSIM1Ready;
        private boolean isSIM2Ready;
        private String sim1_STATE;
        private String sim2_STATE;
        // Integrated circuit card identifier (ICCID)
        private String sim1_ICCID;
        private String sim2_ICCID;
        // International mobile subscriber identity (IMSI)
        private String sim1_IMSI;
        private String sim2_IMSI;
        // Service provider name (SPN)
        private String sim1_SPN;
        private String sim2_SPN;
        // Mobile country code (MCC)
        private String sim1_MCC;
        private String sim2_MCC;
        // Mobile network code (MNC)
        private String sim1_MNC;
        private String sim2_MNC;

        //private NeighboringCellInfo nci;

        //private  List<NeighboringCellInfo> sim1_NC;
        //private  List<NeighboringCellInfo> sim2_NC;
        private String sim1_MCC_MNC;
        private String sim2_MCC_MNC;
        // Mobile subscriber identification number (MSIN)
        // Mobile station international subscriber directory number (MSISDN)
        private String sim1_MSISDN;
        private String sim2_MSISDN;


        // Abbreviated dialing numbers (ADN)
        // Last dialed numbers (LDN)
        // Short message service (SMS)
        // Language preference (LP)
        // Card holder verification (CHV1 and CHV2)
        // Ciphering key (Kc)
        // Ciphering key sequence number
        // Emergency call code
        // Fixed dialing numbers (FDN)
        //getDeviceId() Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.
        private String sim1_IMEI;
        private String sim2_IMEI;
        // Local area identity (LAI)
        private String sim1_LAI;
        private String sim2_LAI;
        // Location Area Code (LAC).
        private String sim1_LAC;
        private String sim2_LAC;


        // Own dialing number
        // Temporary mobile subscriber identity (TMSI)
        // Routing area identifier (RIA) network code
        // Service dialing numbers (SDNs)
        // CellID
        private String sim1_CellID;
        private String sim2_CellID;
        private List<CellInfo> all;


        private TelInfo() {
        }

        /*@
       @requires context != null;
       @ensures TelInfo != null;
          @*/
        public static TelInfo getInstance() {//Context context) {
            //if (TelInfo.telInf != null) {
            TelInfo.telInf = null;
            TelInfo.telInf = new TelInfo();
            //}
            Context context = getMActContext();
            //printTelephonyManagerMethodNamesForThisDevice(context);
            //System.out.println("1 " + context);

            TelephonyManager telMngr = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
            //System.out.println("2 " + telMngr);

            //telInf.nci = new NeighboringCellInfo(NeighboringCellInfo.UNKNOWN_RSSI, new GsmCellLocation().toString(), TelephonyManager.NETWORK_TYPE_HSPA);
            //System.out.println(telInf.nci.toString());


            telInf.sim1_ICCID = telMngr.getSimSerialNumber();
            telInf.sim1_IMSI = telMngr.getSubscriberId();
            telInf.sim1_SPN = telMngr.getSimOperatorName();
            telInf.sim1_MCC = telMngr.getNetworkCountryIso();
            telInf.sim1_MNC = telMngr.getNetworkOperatorName();
            telInf.sim1_MCC_MNC = telMngr.getSimOperator();
            telInf.sim1_MSISDN = telMngr.getLine1Number();
            telInf.sim1_IMEI = telMngr.getDeviceId();
            //telInf.sim1_NC = telMngr.getNeighboringCellInfo();

            if (telMngr.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
                final GsmCellLocation location = (GsmCellLocation) telMngr.getCellLocation();
                if (location != null) {
                    telInf.sim1_LAC = Integer.toString(location.getLac());
                    telInf.sim1_CellID = Integer.toString(location.getCid());
                }
            }

            telInf.imsiSIM2 = null;

            telInf.isSIM1Ready = telMngr.getSimState() == TelephonyManager.SIM_STATE_READY;
            telInf.isSIM2Ready = false;

            telInf.sim1_STATE = simState(telMngr.getSimState());
            try {
                //telInf.isSIM1Ready = getSIMStateBySlot(context, "getSimState", 0);
                telInf.isSIM2Ready = getSIMStateBySlot(context, "getSimState", 1);
                //System.out.println("!!");
            } catch (ITgerMethodNotFoundException e1) {
                //Call here for next manufacturer's predicted method name if you wish
                e1.printStackTrace();
            }

            if (telInf.isSIM2Ready) {
                try {
                    // telInf.sim1_IMSI = getDeviceIdBySlot(context, "getDeviceId", 0);
                    telInf.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceId", 1);
                    telInf.sim2_ICCID = getDeviceIdBySlot(context, "getSimSerialNumber", 1);
                    telInf.sim2_IMSI = getDeviceIdBySlot(context, "getSubscriberId", 1);
                    telInf.sim2_SPN = getDeviceIdBySlot(context, "getSimOperatorName", 1);
                    telInf.sim2_MCC = getDeviceIdBySlot(context, "getNetworkCountryIso", 1);
                    telInf.sim2_MNC = getDeviceIdBySlot(context, "getNetworkOperatorName", 1);
                    telInf.sim2_MCC_MNC = getDeviceIdBySlot(context, "getSimOperator", 1);
                    telInf.sim2_MSISDN = getDeviceIdBySlot(context, "getLine1Number", 1);
                    telInf.sim2_IMEI = getDeviceIdBySlot(context, "getDeviceId", 1);

                    if (telMngr.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
                        final GsmCellLocation location = getCellLocBySlot(context, "getCellLocation", 1);// telMngr.getCellLocation();
                        if (location != null) {
                            telInf.sim2_LAC = Integer.toString(location.getLac());
                            telInf.sim2_CellID = Integer.toString(location.getCid());
                        }
                    }

                    System.out.println("!");
                } catch (ITgerMethodNotFoundException e1) {
                    //Call here for next manufacturer's predicted method name if you wish
                    e1.printStackTrace();
                }
            }

            telInf.scitemsArr = new ArrayList<Sci>();

            telInf.scitemsArr.add(new Sci("SIM 1 state", telInf.sim1_STATE));
            telInf.scitemsArr.add(new Sci("Integrated circuit card identifier (ICCID)", telInf.sim1_ICCID));
            telInf.scitemsArr.add(new Sci("Unique device ID (IMEI or MEID/ESN for CDMA)", telInf.sim1_IMEI));
            telInf.scitemsArr.add(new Sci("International mobile subscriber identity (IMSI)", telInf.sim1_IMSI));
            telInf.scitemsArr.add(new Sci("Service provider name (SPN)", telInf.sim1_SPN));
            telInf.scitemsArr.add(new Sci("Mobile country code (MCC)", telInf.sim1_MCC));
            telInf.scitemsArr.add(new Sci("Mobile operator name", telInf.sim1_MNC));
            telInf.scitemsArr.add(new Sci("Mobile country code + mobile network code (MCC+MNC)", telInf.sim1_MCC_MNC));
            telInf.scitemsArr.add(new Sci("Mobile station international subscriber directory number (MSISDN)", telInf.sim1_MSISDN));
            telInf.scitemsArr.add(new Sci("Location Area Code (LAC)", telInf.sim1_LAC));
            telInf.scitemsArr.add(new Sci("Cell Tower ID (CID)", telInf.sim1_CellID));

            if (telInf.isSIM2Ready) {
                telInf.scitemsArr.add(new Sci(" ", " "));
                telInf.scitemsArr.add(new Sci("SIM 2 state", telInf.sim2_STATE));
                telInf.scitemsArr.add(new Sci("Integrated circuit card identifier (ICCID)", telInf.sim2_ICCID));
                telInf.scitemsArr.add(new Sci("Unique device ID (IMEI or MEID/ESN for CDMA)", telInf.sim2_IMEI));
                telInf.scitemsArr.add(new Sci("International mobile subscriber identity (IMSI)", telInf.sim2_IMSI));
                telInf.scitemsArr.add(new Sci("Service provider name (SPN)", telInf.sim2_SPN));
                telInf.scitemsArr.add(new Sci("Mobile country code (MCC)", telInf.sim2_MCC));
                telInf.scitemsArr.add(new Sci("Mobile operator name", telInf.sim2_MNC));
                telInf.scitemsArr.add(new Sci("Mobile country code + mobile network code (MCC+MNC)", telInf.sim2_MCC_MNC));
                telInf.scitemsArr.add(new Sci("Mobile station international subscriber directory number (MSISDN)", telInf.sim2_MSISDN));
                telInf.scitemsArr.add(new Sci("Location Area Code (LAC)", telInf.sim2_LAC));
                telInf.scitemsArr.add(new Sci("Cell Tower ID (CID)", telInf.sim2_CellID));


                //telInf.scitemsArr.add(new Sci("NC (Neighboring Cell ", telInf.sim1_NC.toString() ));

            }

            return telInf;
        }

        private static String simState(int simState) {
            switch (simState) {
                case 0:
                    return "UNKNOWN";
                case 1:
                    return "ABSENT";
                case 2:
                    return "REQUIRED";
                case 3:
                    return "PUK_REQUIRED";
                case 4:
                    return "NETWORK_LOCKED";
                case 5:
                    return "READY";
                case 6:
                    return "NOT_READY";
                case 7:
                    return "PERM_DISABLED";
                case 8:
                    return "CARD_IO_ERROR";
            }
            return "??? " + simState;
        }

        private static String getDeviceIdBySlot(Context context, String predictedMethodName, int slotID) throws ITgerMethodNotFoundException {

            String imsi = null;
            TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            try {
                Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
                Class<?>[] parameter = new Class[1];
                parameter[0] = int.class;
                Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter);

                Object[] obParameter = new Object[1];
                obParameter[0] = slotID;
                Object ob_phone = getSimID.invoke(telephony, obParameter);

                if (ob_phone != null) {
                    imsi = ob_phone.toString();

                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new ITgerMethodNotFoundException(predictedMethodName);
            }

            return imsi;
        }

        private static GsmCellLocation getCellLocBySlot(Context context, String predictedMethodName, int slotID) throws ITgerMethodNotFoundException {

            GsmCellLocation cloc = null;
            TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            try {
                Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
                Class<?>[] parameter = new Class[1];
                parameter[0] = int.class;
                Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter);

                Object[] obParameter = new Object[1];
                obParameter[0] = slotID;
                Object ob_phone = getSimID.invoke(telephony, obParameter);

                if (ob_phone != null) {
                    cloc = (GsmCellLocation) ob_phone;

                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new ITgerMethodNotFoundException(predictedMethodName);
            }

            return cloc;
        }

        private static boolean getSIMStateBySlot(Context context, String predictedMethodName, int slotID) throws ITgerMethodNotFoundException {
            boolean isReady = false;
            TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            try {
                Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
                Class<?>[] parameter = new Class[1];
                parameter[0] = int.class;
                Method getSimState = telephonyClass.getMethod(predictedMethodName, parameter);
                Object[] obParameter = new Object[1];
                obParameter[0] = slotID;
                Object ob_phone = getSimState.invoke(telephony, obParameter);

                if (ob_phone != null) {
                    int simState = Integer.parseInt(ob_phone.toString());
                    telInf.sim2_STATE = simState(simState);
                    if ((simState != TelephonyManager.SIM_STATE_ABSENT) && (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
                        isReady = true;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new ITgerMethodNotFoundException(predictedMethodName);
            }

            return isReady;
        }

        public static void printTelephonyManagerMethodNamesForThisDevice(Context context) {

            TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            Class<?> telephonyClass;
            try {
                System.out.println("-------------------------------");
                telephonyClass = Class.forName(telephony.getClass().getName());
                Method[] methods = telephonyClass.getMethods();

                for (Method method : methods) {
                    // if (methods[idx].getName().startsWith("get")) {
                    System.out.println("\n" + method.getName() + " declared by " + method.getDeclaringClass());//+ "  superclass " + methods[idx].getDeclaringClass().getSuperclass().getName());
                    //}
                }
                System.out.println("-------------------------------");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        }

        public boolean isSIM1Ready() {
            return isSIM1Ready;
        }

        public boolean isSIM2Ready() {
            return isSIM2Ready;
        }

        private boolean isDualSIM() {
            return imsiSIM2 != null;
        }

        @Override
        public String toString() {
            return "XXXXXXXXXXXXXXXX TelInfo{" +
                    "imsiSIM1='" + sim1_IMSI + '\'' +
                    ", imsiSIM2='" + imsiSIM2 + '\'' +
                    ", isSIM1Ready=" + isSIM1Ready +
                    ", isSIM2Ready=" + isSIM2Ready +
                    '}';
        }

        private static class ITgerMethodNotFoundException extends Exception {
            private static final long serialVersionUID = -996812356902545308L;

            public ITgerMethodNotFoundException(String info) {
                super(info);
            }

        }
    }

我希望这有帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如果双 SIM 卡槽之一的 SIM 卡发生更改,如何检索该卡的信息? 的相关文章

  • 模仿 youtube/gmail 应用程序的导航抽屉

    背景 近几个月来 谷歌发布了Youtube 应用程序 http www androidpolice com 2013 08 19 breaking massive youtube for android v5 0 update brings
  • GCM 无法唤醒设备

    我正在开发 GCM 应用程序 当设备不空闲时 即按电源按钮休眠 一切正常 但是 当我在设备空闲时发送消息时 设备不会唤醒 我做了以下事情 已验证服务器应用程序中的delay while idle未设置为true 每条消息使用不同的折叠键 多
  • 如何使 FirebaseAuth.AuthStateListener 在 Kotlin 中工作?

    class LoginActivity AppCompatActivity private val firebaseAuth FirebaseAuth getInstance private val firebaseAuthListener
  • 使用 setText 更改文本后如何更新屏幕?

    现在我正在使用以下代码来更新TextView txtMain setText new text 该代码执行后 屏幕不会更新新文本 有没有办法可以强制文本立即更新 该代码执行后 屏幕不会更新新文本 一旦您将控制权归还给 Android 就应该
  • Android studio - 如何保存先前活动中选择的数据

    这是我的代码片段 这Textview充当按钮并具有Onclicklistner在他们 当cpu1000时Textview单击它会导致cpu g1000其代码如下所示的类 public class Game 1000 extends AppC
  • SQLite FTS4 使用特殊字符进行搜索

    我有一个 Android 应用程序 它使用 FTS4 虚拟表在 SQLite 数据库中搜索数据 它工作正常 但是当表中的数据包含特殊字符 如 或 时 SQLite MATCH 函数不会给出任何结果 我现在迷路了 谢谢 注意 默认的分词器真的
  • 是否可以将自定义属性添加到 Android 资源的样式中?

    我在我的项目中使用视图流组件 它允许开发人员覆盖一些属性 例如
  • Android 辅助功能服务检测通知

    我试图让我的应用程序在显示通知时进行检测 我已在设置应用程序中启用它并且onServiceConnected确实接到电话 但是当我创建通知或通过 gmail 应用程序接收电子邮件时 什么也没有发生 onAccessibilityEvent没
  • 在 android studio 中找不到 SDK 位置

    我刚刚在 android studio 中导入了我的 eclipse 项目 我一直这么说 Error SDK location not found Define location with sdk dir in the local prop
  • 如何使用 Retrofit 解析嵌套 json....?

    我不知道该怎么办使用 Retrofit 解析 json 熟悉使用 Retrofit 解析简单的 json 但不熟悉解析嵌套Json using Retrofit 这是我的 Json 数据 current observation image
  • 如何仅从 Firestore 获取最新更新的数据?

    在 Firestore 上发现任何更改时始终获取整个文档 如何只获取最近更新的数据 这是我的数据 我需要在第一次加载时在聊天中按对象顺序 例如 2018 09 17 30 40 msg和sendby 并且如果数据更新则仅获取新的msg和se
  • 带有 backstack Resume 的嵌套片段

    在我的应用程序中有几个fragments in an activity我正在维护一个backStack对于这些fragment 一切都很好 但其中有一个嵌套的片段 当我把它放入backStack然后再次按后退按钮恢复 该片段看起来与先前的内
  • react-native android fontFamily 不生效

    问题一 我在index android js的欢迎样式中添加了fontFamily 但没有效果 fontFamily 真的可以在 Android 上使用吗 欢迎 字体大小 20 fontFamily roboto thin 文本对齐 居中
  • Android SHA1 发布密钥库无法与 Google 地图配合使用

    我正在使用 Google Maps Android API 但遇到了一些问题 我正在使用 android studio 签署我的 apk 在 android keystore jks 创建一个 另外 我选择 发布 作为其中的类型 我已经使用
  • Android 4.4 Kitkat 自定义视图操作栏未填充整个宽度

    我试图拥有一个带有自定义视图的简单操作栏 但我得到以下结果 为了演示 我创建了一个带有黄色背景颜色的简单 xml 它应该占据整个宽度 这是 XML
  • 找不到数据库路径是不可能的

    我对 android 开发很陌生 现在我正在尝试通过扩展 SQLiteOpenHelper 的类创建数据库 我确信数据存储在我的 Nexus 7 我用来测试应用程序的设备 上的某个位置 但是我找不到数据库的路径 我四处寻找其他类似的问题 所
  • Android:分配内存失败

    我正在尝试创建一个具有 2047 mb 内存的模拟器 当我运行它时 我收到此错误 2011 02 22 14 24 14 Emulator 2011 02 22 14 24 14 Emulator This application has
  • 如何解决 greenDAO 在执行 InsertOrReplace 时“不存在这样的表错误”?

    我正在使用 greenDAO 并且已成功生成所有必需的类和实体 并且我可以看到我的表已创建 但是在要替换的行上放置断点后 我收到一条错误消息 告诉我 不存在这样的表错误 try appTimeUsageDao insertOrReplace
  • ARM Chromebook 上的 Android 开发环境?

    我尝试了多次安装和使用安卓工作室 https developer android com studio index html on an ARM Chromebook C100P https archlinuxarm org platfor
  • View.post(),以及当Runnables被执行时

    我最初的问题是需要知道我的根的高度和宽度View这样我就可以进行程序化的布局更改 就我的目的而言 我不一定需要在onCreate 对于我来说 以编程方式添加我的孩子就足够了View根布局完成后 因此我很乐意使用onWindowFocusCh

随机推荐

  • Android:表没有名为“变量名称”的列 MySql 数据库错误

    当我尝试在数据库中添加新条目时 出现如下所示的错误 我现在已经搜索了几个小时 但无法发现问题所在 任何输入都会很棒 这里是来自 LogCat 的错误 02 27 23 02 51 451 E SQLiteLog 6777 1 table d
  • 如何在 phpstorm 中使用 phalcon-devtools\ide\phpstorm?

    我正在尝试将 Phalcon 开发人员工具与 phpstorm 集成 有一个视频在这里 http docs phalconphp com en 0 5 0 reference tools html integrating tools wit
  • 从 Visual Studio Code 调试 vue-cli 3 生成的应用程序

    我使用 vue cli 3 0 0 rc 3 生成了一个应用程序 现在我想使用 Visual Studio Code Chrome 调试器 对其进行调试 但是我似乎找不到打开 sourceMaps 的选项 我在 VSCode 中设置了断点
  • 单击按钮后重新绘制 JPanel

    我是 Java Swing 的新手 我有一个奇怪的问题需要刷新我的JPanel 我创建一个静态的JPanel我的框架中的组件 我从一个调用静态方法FileListenner重新粉刷我的JPanel public static void re
  • REST Web 服务版本控制实践

    我正在创建一个新的 Web 服务 并且我已经阅读了 APIgee 的一些电子书 其中建议对 Web 服务进行版本控制 我知道在 URL 与标头中保留版本控制信息之间存在一些 斗争 根据我所阅读和理解的内容 我想在标头中使用版本控制 我的问题
  • 使用 Nancy 返回包含有效 Json 的字符串

    我从另一个服务收到一个包含有效 JSON 的字符串 我只想与 Nancy 转发此字符串 但还将内容类型设置为 application json 这将使我无需在客户端使用 parseJSON data 如果我使用 Response AsJso
  • 你调用的对象是空的

    我使用以下代码来检查之前添加到复选框列表中的数据库表中的值 但在此处收到 对象引用未设置为对象的实例 错误 ListItem currentCheckBox chkbx Items FindByValue rdr MemberID ToSt
  • 如何使用 C# 隐藏/显示进程?

    在执行我的程序时 我想隐藏 最小化 Microsoft 语音识别应用程序 替代文本 http img143 imageshack us img143 9380 minimize png http img143 imageshack us i
  • 有没有办法同时使用布局宽度和高度的权重

    我有一个布局 其中有四个按钮沿着我的应用程序底部分布 使用布局权重将它们均匀分布 我还想使用相同的权重来增加按钮的高度 到目前为止 我所能看到的只是使用水平线性布局计算宽度或使用垂直线性布局计算高度 宽度效果很好 只是高度 如果重量不能同时
  • 通过右键单击任务栏可以防止 WinForms 中的死锁

    我的 Windows C NET 应用程序遇到了一个奇怪的问题 实际上它是一个GUI应用程序 我的工作是包含网络组件 封装在程序集中 我不知道主 GUI 应用程序的代码 不过我可以联系它的开发者 现在 应用程序的 UI 具有用于 启动 和
  • 如何将 java.io.File 转换为 java.lang.Class 来运行它?

    我有一个程序可以让用户选择任何 class or jar文件并运行它 问题是 要运行它 我需要使用除java io File 这是什么JFileChooser返回 我怎样才能做一个java io File into a java lang
  • 定义独立于数据库的 JPA 对象 uid

    事实证明 以下示例在使用 mysql 5 x 时有效 但在使用 oracle 10g 数据库时无效 有没有一种方法可以定义独立于数据库技术的唯一标识符字段 Id GeneratedValue strategy GenerationType
  • Java获取某个目录下所有文件的程序

    我正在开发这个程序来获取目录中的所有文件 由于某种原因 我在第 16 行收到 NullPointerException 但我不知道为什么 因为这是一个似乎在课堂上与我们的老师一起工作的模板 谢谢 import java util impor
  • MySQL 无法从现有表中进行选择,因为它不存在?

    我不知道发生了什么事 我有一张桌子叫project share invite 几个小时前 在我们的生产环境中 我无法再针对该表发出 SELECT MySQL 声称该表不存在 尽管它显示在show tables 今天机器上发生的唯一值得注意的
  • 搜索包含指定文本的 div

    我想在我的网站上创建一个搜索功能 在其中搜索 div 并忽略不符合我搜索内容的 div div 列表如下所示 div class subjects div soccer div div dancing div div soap div di
  • 如何以不同的风格或不同的构建类型使用不同的 proguard 文件?

    我需要为测试库制作不同的风格 为什么 好吧 我希望项目得到完全保护 所以我想始终启用缩小功能 即使对于调试构建类型 在进行测试时 我使用项目中的不同类 所以我决定使用flavor来更改proguard文件 它看起来像这样 android b
  • 使用 ASP.Net MVC 进行分页和排序网格

    想要改进这篇文章吗 提供此问题的详细答案 包括引用和解释为什么你的答案是正确的 不够详细的答案可能会被编辑或删除 我是 MVC 新手 并且不了解如何在网格上进行分页和排序 我习惯于使用 asp Net GridView 控件以及指向业务层中
  • Oracle SQL 一次选择中的非唯一表别名

    有人知道为什么这适用于两个表别名 x 吗 Select x company name x employee name FROM company x JOIN employee x ON x company id 5 我知道 id 5 的 J
  • 什么是 crossdomain.xml 文件?

    其实我希望我知道从哪里开始 我在我的个人网站中嵌入了第三方 SWF 图像库控件 SWF 是 XML 驱动的 我按如下方式动态加载 XML 文件 var flashvars xmlPath http www example com xml a
  • 如果双 SIM 卡槽之一的 SIM 卡发生更改,如何检索该卡的信息?

    我知道我们可以使用 TelephonyManager 类检索单张 Sim 卡的信息 但如何检索多张SIM卡的信息呢 假设我的手机丢失了 有人更换了其中一个插槽中的 SIM 卡 我如何接收 IMEI 号码 电话号码等信息 我只在更换 Sim