I am making a calendar for android, I picked up this tutorial on this site: http://www.androidhub4you.com/2012/10/custom-calendar-in-android.html
I'm having trouble changing some code lines, three problems:
one: the color that indicates the today's day is appearing every month. I would like to only appear in the current month.
two: change the color of the day on Sunday and Monday to red.
three: Do not allow clicks in the days of Sunday and Monday
Code:
Problems one and two:
for (int i = 1; i <= daysInMonth; i++) {
Log.d(currentMonthName, String.valueOf(i) + " "
+ getMonthAsString(currentMonth) + " " + yy);
if (i == getCurrentDayOfMonth()) {
list.add(String.valueOf(i) + "-BLUE" + "-"
+ getMonthAsString(currentMonth) + "-" + yy);
}
//else if not working
else if (i == Calendar.SUNDAY){
list.add(String.valueOf(i) + "-RED" + "-"
+ getMonthAsString(currentMonth) + "-" + yy);
} else {
list.add(String.valueOf(i) + "-WHITE" + "-"
+ getMonthAsString(currentMonth) + "-" + yy);
}
}
Problem three:
Override
public void onClick(View view) {
// i cant implement the if statament for that :(
String date_month_year = (String) view.getTag();
Intent intent = new Intent(getBaseContext(), func_agenda.class);
intent.putExtra("user_auth", "Paulo");
intent.putExtra("user_date", date_month_year);
startActivity(intent);
try {
Date parsedDate = dateFormatter.parse(date_month_year);
Log.d(tag, "Parsed Date: " + parsedDate.toString());
} catch (ParseException e) {
e.printStackTrace();
}
}