获取正确的sim 2运营商名称(SubscriptionInfo)时,获取sim 2数字为空

时间:2019-01-07 06:31:40

标签: java android android-studio mobile

我正在使用SubscriptionInfo读取双重SIM卡信息。 我得到了正确的sim 1的所有详细信息(即sim号,sim运营商名称), 但没有获得sim 2号码。尽管除了sim 2数字信息外,我获取的所有数据都是正确的,但获取sim 2数字NULL。

List<SubscriptionInfo> subsInfoList = subscriptionManager.getActiveSubscriptionInfoList();

    List<String> numbers=new ArrayList<String>();
    List<String> NetworkName=new ArrayList<String>();

    for (SubscriptionInfo subscriptionInfo : subsInfoList) {

        String number=subscriptionInfo.getNumber();
        String name=subscriptionInfo.getCarrierName().toString();

        numbers.add(number);
        NetworkName.add(name);
    }

    Toast.makeText(this, ""+numbers.get(0), Toast.LENGTH_SHORT).show(); //Getting Number Correct
    Toast.makeText(this, ""+numbers.get(1), Toast.LENGTH_SHORT).show(); //Getting Null <--------------

    Toast.makeText(this, ""+NetworkName.get(0), Toast.LENGTH_SHORT).show(); //Getting Network Name Correct
    Toast.makeText(this, ""+NetworkName.get(1), Toast.LENGTH_SHORT).show(); //Getting Netword Name Correct

0 个答案:

没有答案