NameValuePair is deprecated in API 22

Apsaliya picture Apsaliya · Apr 7, 2015 · Viewed 7.4k times · Source

Now that namevaluepair is deprecated in API 22. What can i do if i want to implement 'namevaluepair' interface. below is my code

package com.example.passpass;

import org.apache.http.NameValuePair;

public class DoubleNameValuePair implements NameValuePair{

 String name;

    double value;

    public DoubleNameValuePair(String name, double value) {
        this.name = name;
        this.value = value;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getValue() {
        return Double.toString(value);
    }

}

Answer

Rahul M Mohan picture Rahul M Mohan · Oct 30, 2015

You can use contentValues for example

ContentValues values=new ContentValues();
values.put("username",name);
values.put("password",password);