i made an application which has 3 different buttons and receive different numbers from arduino module via bluetooth each time i press each one of the buttons, For example :

(button 1 pressed) : arduino receives 10 (button 2 pressed) : arduino receives 20 (button 3 pressed) : arduino receives 30

Now i want each one of these to be shown on a chart as sub1 = 10 , sub2 = 20 , sub3 = 30.

The problem is, when i press button 1 it shows the sub1 = 10 on chart But when i press button 2, it shows sub2 = 1020 and for button 3 it shows sub3 = 102030 which is wrong! i want each button to fit the right place separately.

as for my own solution i created an if statement and a string.

for example :

String a == "0"
String b == "0"
String c == "0"

when sending "a" value to arduino, set the "a" string to 1.

while receiving data from arduino, if "a==1" then the data belongs to sub1; same goes for a2 and a3. ( if b==1 it goes to sub2 and etc..) but it didn't work as i was expecting,

i want to clear the android cache so each time i receive a number and it shows on chart, the second number is set as "null" so the second one don't get attached to the first number.

overally i want a way to make this chart w/o all these 3 numbers get attached to eachother.

Help please i'm really stuck in here.