【发布时间】:2014-06-03 10:59:15
【问题描述】:
在我的应用程序中,我使用ArrayList 预加载了 Spinner。ArrayList 包含多个 Text String。这些文本字符串将作为消息template 用户可以从微调器中选择。另外我希望在发送消息时这些字符串关键字可能会被变量替换。比如“Text”将替换为EditText内容,“Phone No”替换为Sender's no,“Date”替换为Message Date
我尝试在 Android 中搜索 HashMap,但遇到问题:
HashMap<String, String> template=new HashMap<String, String>();
template.put("Text", editText.getText().toString());
template.put("Phone No",senderPhone);
template.put("Date",receivedDate);
现在我想将其显示为单个字符串,例如文本、电话号码、日期。这个字符串可以编辑吗?
【问题讨论】:
-
字符串 x=(String)template.get("Text");是获取HashMap值的方法..请解释清楚你想问什么..