我有“在角色中的单词数据库。 我使用Hotal.ttf字体,因为我的语言还没有unicode支持。
我正在从Android SQlite数据库中删除它并在文本视图中显示它。 这是查询代码:
//Get Meaning
public ArrayList<String> getMeaning(String search) {
ArrayList<String> meaningList = new ArrayList<String>();
String searchQuery = "SELECT kMean FROM dictionary WHERE eName LIKE '%" + search + "%' LIMIT 1";
try {
Cursor kCursor = this.getDbConnection().rawQuery(searchQuery, null);
if (kCursor != null) {
kCursor.moveToFirst();
for (int i = 0; i < kCursor.getCount(); i++) {
String sword = kCursor.getString(kCursor.getColumnIndexOrThrow("kMean"));
meaningList.add(sword);
kCursor.moveToNext();
}
kCursor.close();
return meaningList;
}
return meaningList;
} catch (Exception e) {
e.printStackTrace();
}
return meaningList;
}
显示字母{}
请帮助。
答案 0 :(得分:1)
希望它可以帮助您解决问题
它将用于对字符串进行编码/解码以防止连接 破裂
class Character{
sf::Sprite mySprite;
public:
Character(){
sf::texture aTex;
aTex.loadFromFile("c:\users\noob\Desktop\myawesomegame\stripper.png");
mySprite.setTexture(aTex);
}
}
// attempt 2
class Character{
sf::Sprite mySprite;
public:
Character(){
std::unique_ptr<sf::Texture> texture(new sf::Texture);
texture->loadFromFile("c:\users\noob\Desktop\myawesomegame\stripper.png");
mySprite.setTexture(*texture);
}
}
在数据库中存储之前编码/解码字符串
private String GenericMethodToCheckString(String name){
if(name.contains("\"")){
name= name.replace("\"", "####");
}
else if(name.contains("\'")){
name= name.replace("\'", "##");
}
else if(name.contains("##")){
name= name.replace( "##", "\'");
}
else if(name.contains("####")){
name= name.replace("####", "\"");
}
return name;
}
在搜索或获取之前编码/解码字符串
private void InsertInDB(String hotelName){
hotelName = GenericMethodToCheckString(hotelName);
// now put your code to insert your hotel name in sqlite db
}
以这种方式设置
//Get Meaning public ArrayList<String> getMeaning(String search) { search = GenericMethodToCheckString(search); ArrayList<String> meaningList = new ArrayList<String>(); String searchQuery = "SELECT kMean FROM dictionary WHERE eName LIKE '%" + search + "%' LIMIT 1"; try { Cursor kCursor = this.getDbConnection().rawQuery(searchQuery, null); if (kCursor != null) { kCursor.moveToFirst(); for (int i = 0; i < kCursor.getCount(); i++) { String sword = kCursor.getString(kCursor.getColumnIndexOrThrow("kMean")); meaningList.add(sword); kCursor.moveToNext(); } kCursor.close(); return meaningList; } return meaningList; } catch (Exception e) { e.printStackTrace(); } return meaningList; }
TextView