不兼容的类型:ArrayList<BasicNameValuePair>?

incompatible types: ArrayList<BasicNameValuePair>?

我问了问题here。现在我可以将 arraylist 传递给另一个 activity。

在我的第二个 activity 中,我正在尝试 post 这个数组列表。

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

NameValuePair应该是指这个link。根据你的 link,你的 class 没有扩展 NameValuePair。为此,您需要更改代码:

 public class BasicNameValuePair extends NameValuePair implements Parcelable {

和implement/override您wish/is所需的所有必要方法。