vendredi 8 mai 2015

How to save color to sqlite database

So I choose a random color.

Random color = new Random();
final int color2 = (Color.argb(255, color.nextInt(255),color.nextInt(255), color.nextInt(255)));

Then I enter it into the database

HashMap<String, String> colorvalues = new HashMap<String, String>();
        colorvalues.put("boxcolors", String.valueOf(color2));
        controller.insertcolorinfo(colorvalues);
        Log.d(LOGCAT, " NEW COLOR INSERTED"  + colorvalues);

When I check the values in logcat of my newly inserted data I get something like NEW COLOR INSERTED [somenumber,null,null,null] I need to know how to insert this into the database properly so I can retrieve that saved color value later. I do see that there are four variables determining the color that make up color2 but I have no clue how to save them to the database.

Thanks




Aucun commentaire:

Enregistrer un commentaire