I have an arraylist named incorrectAnswers, I want to change the text color of those strings inside that arraylist.
Here's a snippet of my code:
ArrayList<String> incorrectAnswers = new ArrayList<>();
if(mItemArray.get(0).second.startsWith("In")){
numberOfCorrect++;
numberOfTries++;
} else{
numberOfErrors++;
incorrectAnswers.add(mItemArray.get(0).second);
}
if(mItemArray.get(1).second.startsWith("If")){
numberOfCorrect++;
numberOfTries++;
}
else{
numberOfErrors++;
incorrectAnswers.add(mItemArray.get(1).second);
}
This is the layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_layout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="10dp"
android:backgroundTint="@android:color/holo_green_light"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/border_spinner">
<ImageView
android:id="@+id/image"
android:layout_width="1dp"
android:layout_height="1dp"
android:src="@drawable/ic_abrasion"
android:visibility="invisible"/>
<TextView
android:id="@+id/list_text"
android:layout_width="wrap_content"
android:textSize="16sp"
android:textColor="@color/textColor"
android:layout_height="wrap_content"/>
I want to change programmatically the text color of those items I've added inside incorrectAnswers. How can I achieve that?