我试图使用代码
从日历中获取周数据public static String[] getpreviousweek(Context context, int num) {
Log.e("/////////////////", returnPositionIndex(context)+"");
int year = Integer.parseInt(PrefUtil.getFragYear(context));
int month = Integer.parseInt(PrefUtil.getFragMonth(context));
int day = Integer.parseInt(PrefUtil.getFragDay(context));
Log.e("Year", year + " ");
Calendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT+05:30"),Locale.UK);
c.set(year, month, day);
// Set the calendar to monday of the current week
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
c.add(Calendar.DATE, num * 7);
// Print dates of the current week starting on Monday
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
String[] days = new String[7];
for (int i = 0; i < 7; i++) {
days[i] = df.format(c.getTime());
c.add(Calendar.DAY_OF_MONTH, 1);
}
return days;
}
num的值为零..问题是我在摩托罗拉设备中获得了正确的值,并且在nexus中弄错了..无法找到解决方案......
有人请帮我解决一下
答案 0 :(得分:0)
使用这些代码行
time==========================================2015-11-24 PM
<强>输出: - 强>
With the following edge weights:
A -> B = 1
B -> A = -2
For c = -1.5, n = 10, 2 solutions are possible:
A -> B -> A -> B -> A
+1 -2 +1 -2
B -> A -> B -> A -> B
-2 +1 -2 +1
For c = -100, n = 10, no solution is possible
For c = -1.5, n = 3, no solution is possible
Example of a figure 8-like path, assuming all other edge weights are infinite:
c = -150, n = 10
A -> C -> D -> E -> C -> B -> A
-99 -99 +1 +1 +1 +1