NameValuePair deprecated

Gunnar Bernstein

since Android 22 NameValuePair is deprecated.

The documentation sends me to an article about openConnection, but that is what I do. So how is it replaced properly?

I know I can still use it and a string has to be build, just figuring how to pass data between methods.

Peter Knut

You can use ContentValues instead of list of NameValuePair.

Creating:

ContentValues values = new ContentValues();
values.put("key1", "value1");
values.put("key2", 123);

Usage:

for (Map.Entry<String, Object> entry : values.valueSet()) {
    String key = entry.getKey();
    String value = entry.getValue().toString();
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Related Related

HotTag

Archive