Dynamic widget (screen) creation
I'm dealing with a problem you guys might not have faced earlier.
I'm having a use-case in my Android application where the actual screen that i want to show to user is not stored in any layout file of my application. The layout of the of the screen is designed by server in this case, based on selection made by user on first screen.
Let me elaborate here, 1st Screen : List of check box with different biller names. (Imagine i've selected 2 billers from this screen)
2nd Screen : (The screen that server has decided how it should look like) * Header, * 1st Biller name (Label) * Amount for 1st Biller TextBox * Image (a Separator image) * 2st Biller name (Label) * Amount for 2st Biller TextBox. * Here there can be a checbox/radio/another TextBox anything. 开发者_JS百科* Image (a Separator image) * Button (to submit above form back to server)
I hope makes some sense in what i'm planning to design.
The current issues i'm dealing with are as below. 1). How to draw this dynamic widgets? 2). How to fetch user Inputs from this dynamically created widgets?
Thanks in advance. Regards Abhishek
I think you're approaching this the wrong way. The server needs to send data/content - displaying that data is the client applications job. So your problem is here:
The layout of the of the screen is designed by server in this case, based on selection made by user on first screen.
What you want, instead, is a layout defined for every possible selection that a user can make. Then, let the server send you the appropriate data for each view and populate the layout with that data.
精彩评论