I have the following code:
View.OnClickListener calcu = new View.OnClickListener() {
    public void onClick(View v) {
        double q;
        String d = "";
        double factor = cpi[to] / cpi [from];
        DecimalFormat decimalFormat = new DecimalFormat("0.##");
        if (eNum.getText().toString().length() <= 0 || bFrom.getText() == "- Select a Year -" || bTo.getText() == "- Select a Year -") {
            if (eNum.getText().toString().length() <= 0) {
                d += "Enter Dollar Amount";
                eNum.setTextColor(Color.RED);
            }
            if (bFrom.getText() == "- Select a Year -") {
                d += "Select a Year";
                bFrom.setTextColor(Color.RED);
            }
            if (bTo.getText() == "- Select a Year -") {
                d += "Select a Year";
                bTo.setTextColor(Color.RED);
            }
        }
        else {
            dollarAmount = factor * Double.parseDouble(eNum.getText().toString());
            String value = Double.toString(dollarAmount);
            if (value.charAt(value.length() - 2) == '.') {
                value += "0";
            }
            displayToast("Dollar: " + value);
            if (cpi[to] != cpi[from]) {
                double f, y;
                if (cpi[to] > cpi[from]) {
                    f = cpi[to] / cpi [from];
                    y = to - from;
                }
                else {
                    f = cpi[from] / cpi[to];
                    y = from - to;
                }
                q = Math.pow(f, 1/y);
                q = (q-1)*100.0;
                q = Math.round(q*100.0)/100.0;
                displayToast("Inflation: " + String.valueOf(decimalFormat.format(q)));
            }
        }
    }
};
displayToast() is a function which displays the Toast message to the user.
eNum is an EditText
bFrom and bTo are Buttons
What I want to happen when the onClick method is activated:
- If the eNumis empty, I want to make the text color RED.
- If the bFromandbTobuttons text is- Select a Year -, I want to make the text color RED.
- If #1 and #2 is not true than display the Toasts.
Right now when I click, nothing is happening. How do I fix the above code to work correctly?
 
     
    