我收到以下错误.. 无法将Beans转换为ArrayList(String)...
我有一个Beans文件....(Gettter和setters)
ArrayList<Beans> contactList = new ArrayList<Beans>();
List<NameValuePair> params = new ArrayList<NameValuePair>();
for (int i = 0 ; i <contactList.size(); i++) {
List<String> list = contactList.get(i);
params.add(new BasicNameValuePair("name", list.get(1)));
params.add(new BasicNameValuePair("city", list.get(2)));
params.add(new BasicNameValuePair("gender",list.get(3)));
params.add(new BasicNameValuePair("bloodgroup",list.get(4)));
params.add(new BasicNameValuePair("age",list.get(5)));
params.add(new BasicNameValuePair("emailAddress",list.get(6)));
params.add(new BasicNameValuePair("contactNumber",list.get(7)));
params.add(new BasicNameValuePair("imagePath",list.get(8)));
//Post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
JSONObject json = jParser.makeHttpRequest(
_URL, "POST", params);
答案 0 :(得分:0)
contactList.get(i)
会返回Beans
。您正尝试将Beans
对象分配给List
。你需要做
而不是
List<String> list = contactList.get(i);
替换为
Beans list = contactList.get(i);