我在ORMLite documentation中看到存储了带有unicode符号的字符串,你必须使用String (DataType.STRING_BYTES)
。但我是否也要更改ArrayBytes的String属性?
到目前为止,我在我的String属性上方使用了@DatabaseField(dataType = DataType.STRING_BYTES),但这不起作用。
模型
@DatabaseTable(tableName="Messages")
public class Message {
@DatabaseField(dataType = DataType.STRING_BYTES)
private String message;
//get and set methods...
...
}
活动
...
TextView message = new TextView(this);
message.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
message.setText(m.getMessage());
linearLayout.addView(message);
...
答案 0 :(得分:0)
这是Eclipse的一个问题。这段代码完美运行。 出于任何原因,Eclipse有时会替换一些符号,如重音和奇数符号的其他特殊字母。它在保存我的源代码时正在这样做。