3

In Andorid NameValuePair,BasicNameValuePair deprecated. I have

List<NameValuePair> pairs = new ArrayList<NameValuePair>(1);
pairs.add(new BasicNameValuePair("student",string1));

What will be alternative for this code?

user_apr
  • 719
  • 2
  • 10
  • 27

2 Answers2

6

Try using a List of Pair objects, code below from this answer:

List<Pair<String, String>> params = new ArrayList<>();
params.add(new Pair<>("username", username));
params.add(new Pair<>("password", password));
Community
  • 1
  • 1
Filip V
  • 435
  • 4
  • 16
3

You can use ContentValues for example

ContentValues values=new ContentValues();
values.put("student",string1);
Gagan Sethi
  • 397
  • 1
  • 8