我想从“回收商”视图列表中提取号码,然后通过单击按钮拨打电话,我无法为此提供代码以帮助我从中找出答案。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_asi_details);
imageView=(ImageView)findViewById(R.id.dimageviewasi);
textView_name=(TextView)findViewById(R.id.dtextviewasi);
textView_email=(TextView)findViewById(R.id.dtextviewasi1);
textView_mobile=(TextView)findViewById(R.id.dtextviewasi2);
imageView.setImageResource(getIntent().getIntExtra("img_id",00));
textView_name.setText("Name: "+getIntent().getStringExtra("name"));
textView_email.setText("e-Mail: "+getIntent().getStringExtra("email"));
textView_mobile.setText("Mobile: "+getIntent().getStringExtra("mobile"));
button=(Button)findViewById(R.id.asibutton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.aks_phone);
i.setData(Uri.parse(p));
startActivity(i);
}
});
}
答案 0 :(得分:0)
在下面使用代码
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));