Hi developer,
If I selected a value in drop-down like a gender (men,women,kids)
If I selected men I need to send the response as
{
_id: object I'd,
Name:men,
Categories: sunglasses
}
It is possible in Android
Thanks in advance..
@android developer
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gaurav KumarPosted Feb 19, 2020, 11:42 PM
First create a DataModel class or POJO class. Like I named it as TestModel and create 3 fields you above mentioned.
Now set values in the Pojo class by making its object.
E/response Tst: {"Categories":"Android","Gender":"Male","Id":101}
For JsonObject to work we need a library for serialization and deserialization
Add the following code to dependencies in build.gradle of app level.
Amit GuptaPosted Feb 19, 2020, 11:19 PM