的NameValuePair是pcated在API 22日$ P $ [英] NameValuePair is deprecated in API 22

查看:292
本文介绍了的NameValuePair是pcated在API 22日$ P $的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在的NameValuePair是德precated的API 22.我能做些什么,如果我要实现的NameValuePair界面。 下面是我的code

 包com.example.passpass;

进口org.apache.http.NameValuePair;

公共类DoubleNameValuePair实现的NameValuePair {

 字符串名称;

    双重价值;

    公共DoubleNameValuePair(字符串名称,双击值){
        this.name =名称;
        THIS.VALUE =价值;
    }

    @覆盖
    公共字符串的getName(){
        返回名称;
    }

    @覆盖
    公共字符串的getValue(){
        返回Double.toString(值);
    }

}
 

解决方案

您可以使用contentValues​​例如:

  ContentValues​​值=新ContentValues​​();
values​​.put(用户名,名);
values​​.put(密码,密码);
 

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);
    }

}

解决方案

You can use contentValues for example

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

这篇关于的NameValuePair是pcated在API 22日$ P $的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆