此代码就像魅力一样,但在拨号屏幕上,我想让它自动拨打电话。但是我已经将ACTION_DIAL更改为ACTION CALL但仍然没有运气。我已经在清单中提供完全访问权限,但仍然没有按照我的意愿行事。请帮忙。
this.$.outage_table.createComponents([{...}]);
this.$.outage_table.render(); // need to re-render when dynamically adding components
清单文件
EditText firstNumber;
Button btnAdd;
int number = 35;
@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 {
EditText et = (EditText) findViewById(R.id.editText6);
String text= et.getEditableText().toString();
String character = Character.toString((char) number);
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:" + Uri.encode("*221*" + text + "#")));
startActivity(intent);
} catch (Exception e) {
}
}
});
}
}
答案 0 :(得分:1)
如下所示拨打电话,不要忘记向您的舱单添加相关权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
Uri number = Uri.parse("tel:123456789");
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
startActivity(callIntent);