简体   繁体   English

如何在数据库中存储字符串列表?

[英]How can I store list of Strings in DataBase?

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? 是否有可能在数据库中创建ArrayList? or maybe there is another way to solve this problem. 也许还有另一种方法可以解决这个问题。
I am beginner, so I ask for understanding and thank You for any tips 我是初学者,所以我需要了解并感谢您的提示

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));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用领域数据库为recyclerView存储字符串? - How can I use realm database to store strings for recyclerView? 如何将图像和字符串存储在同一数据库表中并检索它们 - How can I store images and strings in the same database table and retrieve them 我如何将推送令牌存储到数据库 - How can i store pushy tokens to database 如何在Android设备中存储数据库? - how can i store database in android device? 如何将日历数据存储在数据库中 - How can I store a calendar data in database 如何从Firebase数据库读取并将信息存储在列表视图中? Android的 - How can I read from a firebase database and store the information within a list view? Android 如何使用 Android KeyStore 安全地存储任意字符串? - How Can I Use the Android KeyStore to securely store arbitrary strings? 我可以将代码中编写的字符串中的数据存储到SQlite数据库中吗? - Can I store data in SQlite database from Strings I've written inside the code? 我可以使用Android PreferenceActivity / PerferenceManager来存储用户管理的字符串列表吗? - Can I use Android PreferenceActivity / PerferenceManager to store a user managed list of strings? 我在哪里可以存储很大的字符串? - Where can I store very large strings?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM