(I changed the question a bit, because the problem is a bit clearer now)
I have 4 buttons on my application, and when a user clickes certain button I change that button color.
when button 3 is clicked I want to change his color to green, otherwise I want remove his green filter (when button1/2/4 are clicked). If I click on button 3 It does get the green filter. If then I click button 4 it removes the green filter, but if I click button 1 or 2, nothing happens. When I switched the position of the buttons in the XML, and put button3 first, It doesnt happen, ideas?
The relevant part of the layout xml is:
<Button
android:id="@+id/ans1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/ans2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/ans3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/ans4"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
The code is:
if (answer.equals("3"))
{
question.setText("In if");
d.setColorFilter(filter);
}
else
{
question.setText("else");
d.setColorFilter(null);
}