Create dynamic view with android
Posted
by ekevin
on Stack Overflow
See other posts from Stack Overflow
or by ekevin
Published on 2010-04-25T12:26:18Z
Indexed on
2010/04/25
12:33 UTC
Read the original article
Hit count: 225
Hi
I'm stuck on a problem and if possible I will need help from the community. I'm not looking for a ready-made solution, but something which would help me to produce the result.
I'm looking for a way to produce a dynamic activity based on a JSON object. Here an example of a JSON object:
[ { "name": "my checkbox name",
"type": "checkbox",
"value": "one,two,three"
}
{ "name": "my edit text",
"type": "text",
"value": ""
}
...]
This JSONObject could be totally random. I could have 2 text views, 3 select menus, 1 text view and so on.
The goal is to iterate over this JSONObject and create the appropriate elements within my android code.
To produce the result I've thought of a simple switch which would render one by one my different JSONObject to an android widget.
But after that how could I have access of every property of every widget rendered?
Thank you.
© Stack Overflow or respective owner