如果双 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 卡发生更改,如何检索该卡的信息? 的相关文章

  • java.lang.IllegalArgumentException:此组件要求您指定有效的 android:textAppearance 属性

    我的布局文件之一中有一个 com google android material button MaterialButton 组件 当我使用最新版本的 Material Components 库 com google android mat
  • 在 Android 上通话结束时启动活动

    我想在通话结束时启动一项活动 找不到任何对此的参考 我该怎么做 我还没有尝试过这个 但我假设你可以运行一些服务 始终在后台运行 它利用电话状态监听器 http developer android com reference android
  • gradle更新后无法找到方法(无法编译项目)

    我尝试将项目中的 gradle 版本更新为 4 1 milestone 1 以下这些说明 https developer android com studio build gradle plugin 3 0 0 migration html
  • 如何自定义菜单项的背景颜色?

    我正在尝试定制Toolbar的弹出菜单 现在我无法设置菜单项的背景颜色 我的 styles xml 如下所示
  • 我在布局上看不到任何 FirebaseRecyclerAdapter 项目

    我试图将数据从 Firebase 数据库检索到我的布局 但我看不到任何项目FirebaseRecyclerAdapter在布局中 请帮忙 我按照一个教程展示了如何做到这一点 当我运行应用程序时 我没有看到任何项目 但我可以滚动 public
  • Cheesesquare:enterAlways 会产生错误的布局

    Adding enterAlways到 Cheesesquare 演示的滚动标志
  • 从响应中获取标头(Retrofit / OkHttp 客户端)

    我正在使用 Retrofit 与 OkHttp 客户端和 Jackson 进行 Json 序列化 并希望获取响应的标头 我知道我可以扩展 OkClient 并拦截它 但这发生在反序列化过程开始之前 我基本上需要的是获取标头以及反序列化的 J
  • Dialog.setTitle 不显示标题

    我正在尝试向我的对话框添加自定义标题 但是每当我运行我的应用程序时 它都不会显示标题 我创建对话框的代码是 final Dialog passwordDialog new Dialog this passwordDialog setCont
  • 在 Cordova 应用程序中获取额外功能

    我们有两个 Android 应用程序 一个使用本机 Java 实现 另一个使用 Ionic 编写 Ionic 应用程序启动我的应用程序 这是使用灯插件 https github com lampaa com lampa startapp 我
  • Android:后台Activity可以执行代码吗?

    后台的活动是否被视为 正在运行 并且可以执行代码 还是处于挂起状态 他们暂停了 活动生命周期 http developer android com reference android app Activity html ActivityLi
  • 图像作为电子邮件附件

    我想构建一个应用程序 我可以在电子邮件中附加图像 打开图像并将其设置为我的壁纸 我想让它跨平台 所以你能告诉我是否可以使用phonegap 或者我是否必须为iphone和android构建一个本机应用程序 您好 如果您只想通过电子邮件附加图
  • 使用 AsyncTask 传递值

    我一直在努力解决这个问题 但我已经到了不知道该怎么办的地步 我想做的是使用一个类下载文件并将其解析为字符串 然后将该字符串发送到另一个类来解析 JSON 内容 所有部件都可以单独工作 并且我已经单独测试了所有部件 我只是不知道如何将值发送到
  • Dagger 2 没有生成我的组件类

    我正在使用 Dagger 2 创建我的依赖注入 几个小时前它还在工作 但现在不再生成组件 这是我创建组件的地方 public class App extends Application CacheComponent mCacheCompon
  • Android 如何将总天数准确更改为年、月、日?

    我正在做一个应用程序 该应用程序与根据给定的生日日期输入获取一个人的年龄有关 为此 我从下面的代码中获取从该日期到当前日期的总天数 String strThatDay 1991 05 10 SimpleDateFormat formatte
  • 上网本上可以进行Android开发吗? [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 我想使用我的上网本进行 Android 开发 但是当我尝试使用 Eclipse 运行 SDK 时 没有加载任何内容 上网本对于 Android 开发来
  • 卡片视图 单击卡片移至新活动

    我是 Android 编程新手 正在研究卡片布局 我想知道如何使其可点击 android clickable true android foreground android attr selectableItemBackground 我的卡
  • 在命令行上卸载 Android SDK 的选定部分

    这与 卸载旧的 Android SDK 版本 https stackoverflow com questions 15182377 uninstall old android sdk versions 除非我想在无头 Linux CI 服务
  • 如何检查 Android 中的同步设置

    我正在构建一个 Android 应用程序 我需要检查设备中注册的每个单独帐户的同步设置 我知道我可以通过 ContentResolver 类来做到这一点 但我遇到了一些问题 我已设法获取设备上所有帐户的列表 但我不知道在运行时从哪里获取特定
  • 通过系统应用程序以编程方式静默安装 apk(无需 root)

    我有带有 android sharedUserId android uid system UID 1000 的系统级应用程序 设备未root INSTALL PACKAGES 权限包含在清单中 我可以静默安装下载的 apk 吗 我已经发现这
  • Android 后台倒计时器

    我有一个 Android 应用程序 它管理一个倒计时器 类 CountDownTimer 它显示在应用程序屏幕中 以显示到达 00 00 还剩多少时间 我现在的问题是 当我按主页按钮或启动另一个应用程序时 应用程序 计时器不会在后台运行 所

随机推荐

  • 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