找到電話號碼Look for a phone number in a string
對於下劃線android: how to add Underline in the String
爲dailer
加入menifest
<uses-permission android:name="android.permission.CALL_PHONE" />
呼叫按鈕
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);
}
}
});
試試這個
<Button
android:id="@+id/btnview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
/>
在
類
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);
}
}
});
現在看到我的答案。我只做了調用按鈕,現在你必須使webview調用按鈕 – Rohit