I would like to create DataBase which rows will be: String model, String date production and list of Bitmaps converted to Strings. But I have no idea how can I create this list. Is there any possibility, for example, to create ArrayList in DataBase? or maybe there is another way to solve this problem.
I am beginner, so I ask for understanding and thank You for any tips
-
Sounds like you have a design problem. You would probably be better off by making a new table and have elements in that table relate to elements in this first table.Automatico– Automatico2014-07-15 11:46:21 +00:00Commented Jul 15, 2014 at 11:46
-
Do you mean, create Database contains String model, String date_production and some reference to DataBase composed of these Strings?user3590445– user35904452014-07-15 12:12:14 +00:00Commented Jul 15, 2014 at 12:12
-
1I don't really understand what you are asking, but what I mean is that you have two tables in your database. One for items that would be in the list of bitmaps you are talking about, and one that has the parent model with. The table with the bitmaps should have an ID column linking it to the elements in the models table. If you don't know what database tables or columns are, google it.Automatico– Automatico2014-07-15 20:50:20 +00:00Commented Jul 15, 2014 at 20:50
Add a comment
|
1 Answer
You have to create one string with some separator like |. If you want write one list of color.
white|blue|green|..
And write this in the database as string. Later to get all your colors you need to do this :
String strInDB = "white|blue|green";
String[] colors = strInDB.split(''|'');
ArrayList<String> myList = new ArrayList<String>(Arrays.asList(colors));
5 Comments
user3590445
I thought about something like that, but won't it be too long, if i write a couple of converted to String Bitmaps? and whether these Strings will not contain special characters?
user3590445
I am sorry for not clearly specify. As Bitmap I mean Bitmap of images
AlonsoFloo
Yeah, but they not exist a array type in all the SGBD. So, you need to create as many column than you have bitmap. Or use this trick ;)
user3590445
Ok, thank you for your response. I am not good enough in this issue, so could you advise me, programmatically is it good option, if I would like to cut some String from this?
AlonsoFloo
With bitmap I don't know. Try it and seen the final String size in memory :)