incompatible types: ArrayList<BasicNameValuePair>?

714 Views Asked by At

I asked question here. Now I can pass arraylist to another activity.

In my second activity, I am trying to post this 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));

I get an error: incompatible types: ArrayList<BasicNameValuePair> cannot be converted to List<? extends NameValuePair>

How can I cast ArrayList<com.example.ss.myapp.BasicNameValuePair> testing to ArrayList<NameValuePair> testing?

1

There are 1 best solutions below

0
Mercato On BEST ANSWER

NameValuePair should be referring to this link. Your class, according to your link, does not extend NameValuePair. To achieve that, you need to change your code:

 public class BasicNameValuePair extends NameValuePair implements Parcelable {

and implement/override all the necessary methods as you wish/is required.