点击按钮打开拨号盘,这个字符串例如String str = "*#06#" 应该在拨号盘中打开。?
click button to open dial pad, this string for example String str = "*#06#" should be open in dial pad.?
我的代码是这样的:
public void onclickdial(View v) {
String str = "*#06#";
startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+str)));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show(); }
但只有一个问题 * 符号显示在拨号屏幕上:
String str = "*#06#";
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.fromParts("tel", str, ","));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
startActivity(callIntent);
或:
String str = "*#06#";
startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+ Uri.encode(str))));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
我的代码是这样的:
public void onclickdial(View v) {
String str = "*#06#";
startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+str)));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show(); }
但只有一个问题 * 符号显示在拨号屏幕上:
String str = "*#06#";
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.fromParts("tel", str, ","));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
startActivity(callIntent);
或:
String str = "*#06#";
startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+ Uri.encode(str))));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();