双卡手机如何指定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); } }
相关推荐
Lzs 2020-10-23
聚合室 2020-11-16
零 2020-09-18
Justhavefun 2020-10-22
jacktangj 2020-10-14
ChaITSimpleLove 2020-10-06
Andrea0 2020-09-18
周游列国之仕子 2020-09-15
afanti 2020-09-16
88234852 2020-09-15
YClimb 2020-09-15
风雨断肠人 2020-09-04
卖口粥湛蓝的天空 2020-09-15
stulen 2020-09-15
pythonxuexi 2020-09-06
abfdada 2020-08-26
梦的天空 2020-08-25