Another way of accomplishing this would be using the Joda Time Package.
Android currently only runs on Java 1.7 and thus does not have good time features by itself.
Add Joda Time to your build.gradle
:
compile 'joda-time:joda-time:2.9.4'
and then you can do something similar to this:
public String getNameOfDay(int year, int yDay) {
String pattern = year + ";" + yDay;
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("y;D");
DateTime requestedDate = DateTime.parse(pattern, dateTimeFormatter);
int dayOfWeek = requestedDate.getDayOfWeek();
//Notice that Monday is 1 and Sunday is 7
String[] days = {"Monday", "Tuesday", "Thursday", "Friday", "Saturday", "Sunday"};
return days[dayOfWeek - 1];
}
Please notice, that I am only offering an alternative to the already posted ways of accomplishing this goal. If you don't want to add joda time to your project you can just go with the ways what the others have already said.