I am trying to create a program that uses a set of checkboxes and numberpickers/number input regions to work out the price of an object. I am just starting out with android, and I can't figure out how to do this, despite looking around a lot.
Here is a dropbox link to the image of what I have created and ideally want in xml
This is basically what I have set up using the XML. The checkboxes at the top relate to different grades of foam which all have different prices, and then the numberpickers will allow selection of the size and thickness of the foam.
So obviously I imagine there will be a fair amount of code to make this work, but I first off I really need to know how to get the values of the sizes, and get which box is checked. Then how to use the checked box and the values to work out a price. I suppose I might need to start a new activity for each of the checkboxes?
You for sure do not need an activity for each component.
In general, what you will want to do is wire up the components to the main activity (e.g. EstimatorActivity or whatever you are calling it) such that as each one's values are changed, methods on the activity are triggered. The controller in an MVC design is a coordinator. The gang of four pattern Mediator is often used to explain this role: the model should not know the specific details of the ui and the ui components should not be bound to the model. (Also, the eventing of the components is really not part of the model.)
When you do interfaces like this, generally you will have some class that produces the estimate. You will create an instance of that when the activity is created, then as the change events occur, you will invoke the calculator again with the new values and update the result field.
Really not that complicated.