Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Owner and Founder. Opencart
In this blog,
I will show, how to create the dynamic views and get the data accordingly.
In this example, I am creating some UI elements on the screen at run time. Creating textview, RadioGroup, CheckBox and Spinner dynamically by dummy JSON data and creating the onclick listener for button. After clicking on the button I will get the data from each created views and show it.
In this example, I have dynamically created four Types of Views
In this example, I have created above view by dummy JSON Data.
I am using option_name as a Heading
and variant_name as a sub data
option_type specifies the Type of the Views which is gotten from the JSON dummy data.
And I have used an ArrayList for storing the instance of the views.
and store the current view
After the views have created, We have to get the data which is selected in the views.
Then first we have to get the instance of current view
and then by below code you can get the data from spinner
Here I get the variant name of the spinner view but we can get anything which we want to get from views.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Instead, it should be casted properly as:
Spinner spinner = (Spinner) allViewInstance.get(noOfViews);
when another checkbox is added in the json dummy data.
Can you please share the stacktrace of the issue you are getting ?
Or if you want you can collect all the data first and then validate with a similar function.
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.