i am working in android.
i want to call a number which is displaying in textbox. this is my code in xml file:-
<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"/>
and this is my code:-
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);
}
});
This above code is working properly. But problem is this , whenever i click on contact number then that call window opens, even if i dont want to call that number and press back button then also my call is connecting.
So please tell me what should i do for this, so when i press back button then call should not connect.
Change your intent type to
Intent.ACTION_DIALUsing this intent type you have choice of calling or not calling that number.