我在android上工作。
我想呼叫一个显示在文本框中的号码。这是我在xml文件中的代码:
<TextView android:id="@+id/textView_event_place_contactNo"
android:text="Contact No"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:phoneNumber="true" android:autoLink="phone"/>这是我的代码:
textView_contactNo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:9783506635"));
startActivity(callIntent);
}
});上面的代码工作正常。但问题是,每当我点击联系号码时,呼叫窗口就会打开,即使我不想呼叫那个号码并按下后退按钮,我的呼叫也在连接中。
所以请告诉我我应该怎么做,所以当我按下后退按钮,然后呼叫不应该连接。
发布于 2011-12-05 20:16:22
将您的意图类型更改为Intent.ACTION_DIAL
Intent callIntent = new Intent(Intent.ACTION_DIAL);使用此意图类型,您可以选择呼叫或不呼叫该号码。
发布于 2011-12-05 20:15:44
我认为呼叫没有结束,因为当您按back键时,呼叫管理器隐藏在后台...
发布于 2012-10-29 20:27:42
您不需要setOnClickListener.The属性,android:autoLink="phone"将完成所有工作
https://stackoverflow.com/questions/8385112
复制相似问题