【发布时间】:2017-11-24 13:58:47
【问题描述】:
我问了问题here。现在我可以将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?
【问题讨论】:
-
到目前为止,您的代码看起来不错,但为了使这种转换成为可能,
BasicNameValuePair必须扩展NameValuePair。你能仔细检查一下吗? -
谢谢,当我这样做时,它会起作用。 @lulian Popescu
标签: java android arraylist basicnamevaluepair