• 双卡手机怎么指定SIM卡打电话


    双卡手机如何指定SIM卡打电话

    package com.example.dualsimtest;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.EditText;
    import android.widget.Toast;
    
    public class MainActivity extends Activity {
        public static final String[] dualSimTypes = { "subscription", "Subscription", 
            "com.android.phone.extra.slot", 
            "phone", "com.android.phone.DialingMode", 
            "simId", "simnum", "phone_type", 
            "simSlot" };
        EditText inputV;
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            
            inputV = (EditText) findViewById(R.id.input);
            
            findViewById(R.id.call).setOnClickListener(new View.OnClickListener() {
                
                @Override
                public void onClick(View arg0) {
                    String number = inputV.getText().toString().trim();
                   if (number.equals("")) { 
                       Toast.makeText(MainActivity.this, "输入号码不恩为空", 1500).show();
                   } else {
                       call(number); 
                   }
                }
            });
        }
        
        
        private void call(String phone) {
            Intent callIntent = new Intent(Intent.ACTION_CALL)
                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            callIntent.setData(Uri.parse("tel:" + phone));
            for (int i=0; i < dualSimTypes.length; i++) {
                callIntent.putExtra(dualSimTypes[i], 2);
            }
            this.startActivity(callIntent);
        }
        
    }
  • 相关阅读:
    第一次留下自己的随笔
    NSOperation多线程方式
    NSThread多线程方式
    GCD多线程机制
    GCD创建单例常用的两种方法
    线程锁
    使用KVO模式,设置应用角标数字
    keyChain RSA加密 KVO
    NSURLConnection网络处理和NSURLSession网络处理
    UIAlertView和UIAlertViewController
  • 原文地址:https://www.cnblogs.com/kobe8/p/3820474.html
Copyright © 2020-2023  润新知