20250906_012327_326
This commit is contained in:
@@ -57,6 +57,7 @@ public class ComposeSMSActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
LogUtils.d(TAG, "onCreate");
|
||||
setContentView(R.layout.activity_composesms);
|
||||
|
||||
// 初始化Intent数据(增加空判断,避免NullPointerException)
|
||||
@@ -192,8 +193,20 @@ public class ComposeSMSActivity extends BaseActivity {
|
||||
|
||||
// 定位到第一个匹配项(如果有)
|
||||
if (!matchedContacts.isEmpty()) {
|
||||
mlvContracts.setSelection(0);
|
||||
mtvTOName.setText(matchedContacts.get(0).getName());
|
||||
//LogUtils.d(TAG, String.format("matchedContacts.size() %d", matchedContacts.size()));
|
||||
// 先设置列表选中项
|
||||
//mlvContracts.setSelection(0);
|
||||
for (int i = 0; i < matchedContacts.size(); i++) {
|
||||
PhoneBean item = matchedContacts.get(i);
|
||||
//LogUtils.d(TAG, String.format("item.getTelPhone() %s", item.getTelPhone()));
|
||||
//LogUtils.d(TAG, String.format("metTO.getText() %s", metTO.getText()));
|
||||
if (item.getTelPhone().equals(metTO.getText().toString())) {
|
||||
mtvTOName.setText(item.getName());
|
||||
mlvContracts.setSelection(i);
|
||||
LogUtils.d(TAG, String.format("%s match %s", metTO.getText().toString(), item.getTelPhone()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mtvTOName.setText(""); // 无结果时清空姓名显示
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user