无法将sqlite记录发布到服务器

时间:2014-07-10 14:00:59

标签: java android json sqlite

我收到以下错误.. 无法将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);

1 个答案:

答案 0 :(得分:0)

contactList.get(i)会返回Beans。您正尝试将Beans对象分配给List。你需要做

而不是

List<String> list =  contactList.get(i);

替换为

Beans list =  contactList.get(i);