如何使用Android拨号程序调用以“#”符号结尾的数字?
我的代码如下,
EditText firstNumber;
Button btnAdd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main23);
Toast.makeText(Main23Activity.this,
"Type in your Pin Number", Toast.LENGTH_LONG).show();
btnAdd = (Button)findViewById(R.id.button12);
btnAdd.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
numberSign = "#";
EditText et = (EditText) findViewById(R.id.editText6);
String text= et.getEditableText().toString();
Toast.makeText(Main23Activity.this,
"Adding Money to your account has never been this easy", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:*221*" + text + numberSign ));
startActivity(intent);
} catch (Exception e) {
}
}
});
}
}
答案 0 :(得分:0)
这是你使用android拨号器调用以'#'结尾的数字的方法。您需要编码然后解析。
尝试以下代码,
String text = et.getText().toString();
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + Uri.encode("*221*" + text + "#")));
startActivity(intent);
答案 1 :(得分:0)
使用此链接 you can get unicode and hex values
例如36可以作为
存储在strings.xml中 <string name="abcd">36</string>