Hi …
I have a problem . I want to store the colour information into a xml and read it from the file again and update the colour in the UI .
My problem is I have to store the colour in form of string into the file . And from the file read the string and convert it to original colour information . I am not finding the way to do it . Could anyone please help me out in this


Perhaps Colour::toString() and Colour::fromString() ??!


Thanks a lot for the reply .
One other problem is I have do the same with array of double values . I want to save the array values in to the file . My requirement is I have to convert array of double to string format , write it into file and then read from file and convert it back to array of double . Can you please help me out


For things like that you need to write your own save() and restore() methods, for simple stuff like numeric primitives it’s a one liner. It gets complicated once you try to serialize more complex objects.


Colour::toString() and Colour::fromString() .is not working out for me .

Colour ss = Colours::red;
String temp = ss.toString();
Colour st;

The RGB value of the colour st obtained is all 0 and the not the proper values . Can anyone help me out


fromString is a static function, and returns the colour, rather than assigning it (as a static function doesn’t have an instance to assign to).

So, you’d change that to:

Colour ss = Colours::red;
String temp = ss.toString();
Colour st = Colour::fromString(temp);