I have a if condition for check value in textview but it still happen only else condition
what I did wrong, why it doesn’t have if condition even if I have set lang=space
private void setLangTitle() {
lang.setText(" ");
db.open();
Cursor cc = db.getLangAct();
cc.moveToFirst();
int index = cc.getColumnIndex(DBAdapter.KEY_LANG);
while (cc.isAfterLast() == false) {
if(lang.equals(" ")){
lang.append("p"+cc.getString(index));
cc.moveToNext();
}
else {
lang.append("/" + cc.getString(index));
cc.moveToNext();
}
}
db.close();
}
You’re currently checking if
langis equal to a space character. Iflangis a TextView, than it will not be equal to the space character because it is a TextView object, not a string. You probably want to test if the text being displayed onlangis equal to the space character, which would be something along the lines of: