1

我在这里问了问题。现在我可以将arraylist 传递给另一个活动。

在我的第二个活动中,我试图发布这个数组列表。

ArrayList<com.example.ss.myapp.BasicNameValuePair> testing = this.getIntent().getParcelableArrayListExtra("extraextra");

 HttpClient httpclient1 = new DefaultHttpClient();
                        HttpPost httppost1 = new HttpPost(url);
                        httppost1.setEntity(new UrlEncodedFormEntity((List<? extends org.apache.http.NameValuePair>) testing));

我收到一个错误: incompatible types: ArrayList<BasicNameValuePair> cannot be converted to List<? extends NameValuePair>

我怎样才能ArrayList<com.example.ss.myapp.BasicNameValuePair> testing投到ArrayList<NameValuePair> testing

4

1 回答 1

1

NameValuePair应该是指这个链接。根据您的链接,您的课程不会扩展NameValuePair. 为此,您需要更改代码:

 public class BasicNameValuePair extends NameValuePair implements Parcelable {

并根据需要/需要实现/覆盖所有必要的方法。

于 2017-11-24T14:03:48.490 回答