sis*_*sko 5 foreach android list
我正在开发一个Android项目,我有以下代码段,它们将信息收集到一个"数组"中:
//setup array containing submitted form data
ArrayList<NameValuePair> data = new ArrayList<NameValuePair>();
data.add( new BasicNameValuePair("name", formName.getText().toString()) );
data.add( new BasicNameValuePair("test", "testing!") );
//send form data to CakeConnection
AsyncConnection connection = new AsyncConnection();
connection.execute(data);
我的问题是如何在我的AsyncConnection类中读取该数据列表的各个成员?
MH.*_*MH. 16
您应该简单地遍历列表以访问每个列表NameValuePair.使用getName()和getValue()方法,您可以检索每对的各个参数.
for (NameValuePair nvp : data) {
    String name = nvp.getName();
    String value = nvp.getValue();
}
| 归档时间: | 
 | 
| 查看次数: | 6906 次 | 
| 最近记录: |