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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Gaurav KumarRank #306 · 8.2K reputationPosted Feb 19, 2020, 6:42 PM EST
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 GuptaRank #190 · 12.8K reputationPosted Feb 19, 2020, 6:19 PM EST