Q:

android listview change color but fail

I have a listview and listview has some data,
I hope these data have different color
EX: if this is Lesson 1 color blue and Lesson 2 is color red.....
so,I use  
name.setTextColor(Color.BLUE);
but it can not change.
why?

this is my code:  
public class Listening extends AppCompatActivity {
    ArrayList<Listenlist> listenlists = new ArrayList<Listenlist>();
    ListView listview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listening);
        listview = (ListView) findViewById(R.id.list);
        seraechsql2();
    }
    public void seraechsql2(){
        View v =null;
        String result = dblisten.executeQuery();

        try{

           TextView name = ((TextView) v.findViewById(R.id.name));
            JSONArray jsonArray = new JSONArray(result);
            length=jsonArray.length();
            for(int i =0; i < jsonArray.length(); i++) 
            {
                JSONObject jsonData = jsonArray.getJSONObject(i);
                String les=jsonData.getString("lesson");
                Listenlist team = new Listenlist("L"+les);
               if(les==.....){//my condition
              name.setTextColor(Color.BLACK);//I try to change it to black but fail
               }
                listenlists.add(team);
                final ListenlistAdapter adapter = new ListenlistAdapter(this, R.layout.listenlist, listenlists);
                listview.setAdapter(adapter);
                listview.setTextFilterEnabled(true);
                listview.setSelector(R.drawable.green);
            }
        }
        catch(Exception e){}
    }
}

thanks

A:

I would suggest you to use RecyclerView to list display list of items. You can update based color based on the item position.
refer this link - https://developer.android.com/guide/topics/ui/layout/recyclerview 
More explaination - 
Changing color of items in ListView - Android

