How do I add JSON get method in my android app

时间:2019-01-26 20:49:49

标签: json android-studio org.json

I am trying to develop a simple android app where a user can enter a username and password and then when they click login, it compares the information with that in the database. If the information is correct, then a new activity is opened showing success message. I would like to use JSON get method. I already have an API key for this but am an absolute beginner so any help on how to go about this will be highly appreciated

1 个答案:

答案 0 :(得分:0)

我假设您想从用户那里输入UsernamePassword作为输入,然后要调用API进行身份验证。 假设您输入的json对象看起来像这样

{
"Username":"myName",
"Password":"qwerty"
}

然后您将获得所需的信息,例如

jsonObject.get("Username");

这将返回您输入的用户名,密码也一样 那么您可以使用此信息调用身份验证API。