Click here to Skip to main content
14,239,593 members
Rate this:
Please Sign up or sign in to vote.
See more:
How do I sum up parameters from 2 different listview together provided that the total data from each listviews increases after each button clicked?

I want to make a textview which sums up the overall data from 2 listviews which have their total data of its own.

Do I make a textview inside the button void method or in the oncreate method? If so, how do i sum both of the listviews data altogether?

What I have tried:

Have tried getting the data from the textviews of listview1 and listview2 by getText and changing it to integer. Combine both of its data and change it back to string and input it back in Texview3.

Result, app crashes.
Posted
Updated 7-Jul-19 21:53pm
v2
Comments
Richard MacCutchan 7-Jul-19 7:37am
   
Without more information it is impossible to guess what your problem may be. Please edit your question and show the code that performs these calculations, and indicate where the crash occurs.
wseng 8-Jul-19 3:55am
   
I would suggest you post your code to github or here, so we can test it
David Crow 8-Jul-19 11:59am
   
"...how do i sum both of the listviews data altogether?"

By adding the values at the same time you are populating the listview's adapter.


"Result, app crashes."

This statement is of no value whatsoever.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100