我有一個簡單的android應用程序,我正在測試以進行VOIP呼叫。在佈局我有一個TextView如圖使用Android提示作爲默認電話或電子郵件
<org.myapp.ui.AddressText
android:id="@+id/address"
android:background="@color/colorF"
android:textColorHint="@color/colorI"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="20dp"
android:paddingRight="5dp"
android:layout_toLeftOf="@id/erase"
android:layout_centerVertical="true"
android:selectAllOnFocus="false"
android:hint=" [email protected]"
android:clickable="false"
android:editable="false"
android:cursorVisible="false"
android:focusableInTouchMode="false"
android:focusable="false"
android:textIsSelectable="false"
android:visibility="visible"
android:inputType="phone" />
</RelativeLayout>
我也有一個呼叫按鈕,鏈接到的TextView 我想,當用戶按下呼叫按鈕,在不改變SIP地址,應用程序應該自動拾取默認(提示)SIP地址和撥號。可能嗎?
我的意圖函數如下; private AddressText mAddress;
public void OutgoingCall(Intent intent) {
if (intent != null && intent.getData() != null) {
String scheme = intent.getData().getScheme();
if (scheme.startsWith("imto")) {
mAddress.setText("sip:" + intent.getData().getLastPathSegment());
} else if (scheme.startsWith("call") || scheme.startsWith("sip")) {
mAddress.setText(intent.getData().getSchemeSpecificPart());
} else {
Uri contactUri = intent.getData();
String address = "";
if(address != null) {
mAddress.setText(address);
} else {
//else statement
}
}
mAddress.clearDisplayedName();
intent.setData(null);
myPhoneManager.getInstance().newOutgoingCall(mAddress);
}
你試過'getHint()''TextView'類的API? – AADProgramming