So I'm trying to do a calorie counter. I have an array with many food items and another array with the values of each food item (just numbers in order as the food).
I have 3 Spinners too that shows and allows the user to choose a food in every spinner, and then there is a plain textview
that will show the resulting sum of the all calories for each food we've selected.
The only thing I need to know is how can I increment this number.
This is the 2 arrays that I got:
<resources>
<string name="app_name">calorias</string>
<array name="comida">
<item>Seleccione</item>
<item>tortilla</item>
<item>patatas fritas</item>
<item>arroz</item>
<item>salmon</item>
<item>pollo</item>
<item>pasta</item>
<item>ensalada</item>
<item>atun</item>
<item>salchichas</item>
<item>espinacas</item>
</array>
<array name="calorias">
<item>0</item>
<item>500</item>
<item>674</item>
<item>1170</item>
<item>508</item>
<item>199</item>
<item>270</item>
<item>98</item>
<item>234</item>
<item>1670</item>
<item>310</item>
</array>
</resources>
I don't know how can I do it.
question from:
https://stackoverflow.com/questions/65848176/how-can-i-plus-objects-in-an-array-in-android 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…