Hier daysofInterest wie ["Dienstag", "Donnerstag", "Freitag", "Freitag"] wie folgt, teile ich diese Zeichenfolge von "," mit daysArray, und die Überprüfung mit dem Array, aber ich bekomme nicht das Ergebnis, wie ich will, bitte können Sie es beheben. und immer daysArray wie diese [Ljava.lang.String;@e856c3b
Ändere die Farbe der Textansicht beim Vergleich mit einer Zeichenkette, die im Array ist
String daysOfInterest=map.get("daysOfinterest");
Log.d("DAYS OF INTEREST",daysOfInterest);
String[] daysArray = daysOfInterest.split(",");
Log.d("DAYS",daysArray.toString());
for(int i=0;i<daysArray.length;i++){
if(daysArray[i].equalsIgnoreCase("sunday")){
tvSunday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvSunday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("monday")){
tvMonday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvMonday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("tuesday")){
tvTuesday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvTuesday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("wednesday")){
tvWednesDay.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvWednesDay.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("thursday")){
tvThursday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvThursday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("friday")){
tvFriday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvFriday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
if(daysArray[i].equalsIgnoreCase("saturday")){
tvSaturday.setBackground(ContextCompat.getDrawable(ActivitySavedCareAlerts.this,R.drawable.style_circle_filled_green));
tvSaturday.setTextColor(ContextCompat.getColorStateList(getApplicationContext(),R.color.white));
}
}
return convertView;
}
Verwenden Sie sonst, wenn und nicht nur wenn –
es zwei Fehler gibt –
bitte können Sie meine Fehler zeigen? – ajay110125