Hi I'm a new android developer. I try to change some element in my item once on click, this is my code
ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ImageView img = findViewById(R.id.imageView2);
img.setImageResource(R.drawable.validate);
TextView txtNumTicket, txtCaisse;
txtNumTicket = findViewById(R.id.ref);
txtCaisse = findViewById(R.id.textView);
txtNumTicket.setTextColor(ContextCompat.getColor(Commande.this, R.color.bon));
txtCaisse.setTextColor(ContextCompat.getColor(Commande.this, R.color.bon));
Toast.makeText(getApplicationContext(), "You have selected item no."
+ (i + 1) + "", Toast.LENGTH_SHORT).show();
}
});
I wanna return to the initial state (change image to R.id.novalidate and color textview) when position equal 6, How can I do it ?