Reputation: 2486
Here is my Model Class
public class Sell {
private String transactionID;
private int dollarPrice;
private boolean isInParts;
private String itemName;
public Sell() {
}
public Sell(String transactionID,
int dollarPrice,
boolean isInParts,
String itemName) {
this.transactionID = transactionID;
this.dollarPrice = dollarPrice;
this.isInParts = isInParts;
this.itemName = itemName;
}
public String getTransactionID() {
return transactionID;
}
public int getDollarPrice() {
return dollarPrice;
}
public boolean isInParts() {
return isInParts;
}
public String getItemName() {
return itemName;
}
public void setTransactionID(String transactionID) {
this.transactionID = transactionID;
}
public String getSellingString() {
String string = "I want to Sell "+DOLLAR_SIGN+dollarPrice+ " "+itemName;
if (isInParts) {
string += " in Parts";
// I want to sell $100 Goods in Parts
}
}
return string;
}
}
When i commit it to firebase with the following parameters
transactionId = "6475xxx-xxxxxxxxxxx" dollarPrice = 100 inParts = true itemName = "Goods"
i get the following in my firebase dashboard
{
"dollarPrice" : 100,
"inParts" : true,
"itemName" : "Goods",
"transactionID" : "6475xxx-xxxxxxxxxxx"
}
but in my recycler view's view holder i have a text view which i set the following text
textview.setText(sell.getSellingString());
my textView always displays
I want to sell $100 Goods
Instead of
I want to sell $100 Goods in Parts
Thereby neglecting the boolean value i specified.
How can i get Around this?
Upvotes: 0
Views: 268
Reputation: 2486
This => Firebase won't bind boolean value to field
Answered my question.
When trying to get a boolean
private boolean up;
public boolean isUp() {
return up;
}
if your boolean field is named isUp, then the getter must be named isIsUp() or getIsUp(). Alternatively, if you want a getter named isUp, the field name would be up.
Upvotes: 1