to find phone number Look for a phone number in a string
For underline android: how to add Underline in the String
for dailer
add in menifest
<uses-permission android:name="android.permission.CALL_PHONE" />
for call button
Button callButton = (Button)findViewById(R.id.btnCall);
txtPhn = (EditText)findViewById(R.id.txtPhnNumber);
callButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+txtPhn.getText().toString()));
startActivity(callIntent);
} catch (ActivityNotFoundException activityException) {
Log.e("Calling a Phone Number", "Call failed", activityException);
}
}
});
try this
<Button
android:id="@+id/btnview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
/>
in class
Button btn = (button)findViewbyid(R.id.btnview);
btn.setText("YOUR Phone number");
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+btn.getText().toString()));
startActivity(callIntent);
} catch (ActivityNotFoundException activityException) {
Log.e("Calling a Phone Number", "Call failed", activityException);
}
}
});