我需要将一个字符串数组保存到数据库,但它不会让我.这就是我所拥有的:
public long createEntry(String startTime, String endTime, String[] states) {
ContentValues initialValues = new ContentValues();
initialValues.put(START_KEY_TIME , startTime);
initialValues.put(END_KEY_TIME , endTime);
initialValues.put(KEY_STATE, states );
return databaseConnect.insert(DATABASE_TABLE, null, initialValues);
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我把string[]状态放入,它说内容值不能参与.我该如何解决这个问题?我以为我在状态中有7个东西,我可以喜欢有7个单独的字符串并在每个中存储东西然后将所有字符串放回字符串数组中吗?或者这是不好的做法?