gpt4 book ai didi

java - 不兼容类型 : ArrayList?

转载 作者:行者123 更新时间:2023-11-30 00:14:41 24 4
gpt4 key购买 nike

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

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

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> testingArrayList<NameValuePair> testing

最佳答案

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

 public class BasicNameValuePair extends NameValuePair implements Parcelable {

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

关于java - 不兼容类型 : ArrayList<BasicNameValuePair>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474834/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com