Ubidots Community

[SOLVED] Android studio and getValues()

Hi guys. I am new using java and i am working with android studio.

I have some data in a variable, and i wanna read it in my app, but when i use the command
variable.getValues(), i don’t know what to do with that, i can’t convert it to string o int and i am really lost.

Some one know what do i have to do to get any element and put it in a textview???

Hi,

The method getValues return a Array of Value then for to uses the value of the first element:

Value[] values = variable.getValues();
double vl = values[0].getValue();  // double type.
String vlStr = String.valueOf(vl);  // string type.

You can use the variable vlStr (string) to put in a textview.

Gustavo.

1 Like

Thank you!!!

It works perfectly!!!