Category Archives: basicnamevaluepair

Is it alright if I use ‘org.apache.http.legacy’ and continue using deprecated stuffs like NameValuePair and others?

I am trying to integrate CCAvenue payment gateway onto my android application. For that, I downloaded their integration kit and used it. But, the kit that is available currently imports org.apache.http and uses its functionalities like httppost, namevaluepair, etc. So, my question is, as mentioned here, is it alright to make below mentioned changes in the gradle and continue using deprecated libraries?

android {
    useLibrary 'org.apache.http.legacy'
}

BasicNamePairValue is not working for API 23 [duplicate]

This question already has an answer here:

Here is the Code of a Function, I am using to build Array which I want to pass to the PHP server using Json.

enter image description here

public JSONObject loginUser(String phone, String password) {

    //ContentValues values=new ContentValues();
    //values.put("phone",phone);
    //values.put("password",password);


    // Building Parameters
    List params = new ArrayList();
    params.add(new BasicNameValuePair("tag", login_tag));
    params.add(new BasicNameValuePair("phone", phone));
    params.add(new BasicNameValuePair("password", password));
    JSONObject json = jsonParser.parse(loginURL,params);
            getJSONFromUrl(loginURL, params);
    return json;
}

The android studio shows error in BasicNameValuePair. Also, the imports are greyed out.

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

Is there any other way I can use to develop for API 23? I am stuck here.

BasicNamePairValue is not working for API 23 [duplicate]

This question already has an answer here:

Here is the Code of a Function, I am using to build Array which I want to pass to the PHP server using Json.

enter image description here

public JSONObject loginUser(String phone, String password) {

    //ContentValues values=new ContentValues();
    //values.put("phone",phone);
    //values.put("password",password);


    // Building Parameters
    List params = new ArrayList();
    params.add(new BasicNameValuePair("tag", login_tag));
    params.add(new BasicNameValuePair("phone", phone));
    params.add(new BasicNameValuePair("password", password));
    JSONObject json = jsonParser.parse(loginURL,params);
            getJSONFromUrl(loginURL, params);
    return json;
}

The android studio shows error in BasicNameValuePair. Also, the imports are greyed out.

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

Is there any other way I can use to develop for API 23? I am stuck here.