我有一个这样的 JSONstring,并从 JSONstring 中获取每个字符串 ...
运行时出现此错误错误转换结果 java.lang.NullPointerException
我应该怎么办???
{"login":"1","error":"","id":"1","namespace":"dhruv","first_name":"Dhruv","last_name":"Patel","pro_pic_64_url":"URL","pro_pic_100_url":"URL","pro_pic_200_url":"URL"}
以及我解析这些数据的代码
JSONObject json = new JSONObject(data);
String login = json.getString("login");
TextView welcome =(TextView)findViewById(R.id.textView1);
welcome.setText(login);
if(login=="1")
{
String namespace = json.getString("namespace");
String id = json.getString("id");
String first_name = json.getString("first_name");
String last_name = json.getString("last_name");
String pro_pic_64_url = json.getString("pro_pic_64_url");
String pro_pic_100_url = json.getString("pro_pic_100_url");
String pro_pic_200_url = json.getString("pro_pic_200_url");
}