I have a class that places a text into an arrayList. Then it makes all the variables into CharSequences, when I try to compare the variables to a String such as == "test"; it doesn't work here is my code that I use to get the variables
class Item {
String descs;
public Item (String descs){
this.descs = descs;
}
public CharSequence getDescs() {
return descs;
}
}
This is the code that compares it to the String
if(p.getDescs().toString() == "trash"){
descsView.setVisibility(View.GONE);
}
else{
descsView.setText(p.getDescs());
}
I know for a fact that p.getDescs() is equal to trash because when it sets the text for descsView it is set to trash. SO why doesn't the first if statement work?