アプリケーションで月の週を設定するカレンダーを設定しています。
これが変数 1 です。
Long date1 = cursor.getLong(12); // first I load a choosen date to a database
//date result is 1365569546000
//then I convert to string
SimpleDateFormat sdfd = new SimpleDateFormat("d");
String day3 = sdfd.format(date1);
SimpleDateFormat sdfm = new SimpleDateFormat("M");
String month3 = sdfm.format(date1);
SimpleDateFormat sdfy = new SimpleDateFormat("yyyy");
String year3 = sdfy.format(date1);
intent.putExtra("days",day3);
intent.putExtra("months",month3);
intent.putExtra("years",year3);
2つの新しいアクティビティ。
Bundle extras2 = getIntent().getExtras();
dayWeek = extras2.getInt("days");
monthWeek = extras2.getInt("months");
yearWeek = extras2.getInt("years");
手動挿入を使用する前に、結果は2です。
これがコードです。
Calendar calFr = Calendar.getInstance(TimeZone.getTimeZone("Asia/Jakarta"));
calFr.setFirstDayOfWeek(Calendar.MONDAY);
calFr.set(2013, Calendar.APRIL, 10);
int weekOfMonthFr = calFr.get(Calendar.WEEK_OF_MONTH);
TextView txtMinggu = (TextView) findViewById(R.id.week);
txtMinggu.setText(""+weekOfMonthFr);
、しかし今は変数 EXTRAS を使用して月の週を設定します。
ここにコードがあります
calFr.set(yearWeek, monthWeek, dayWeek);
年週 = 2013;
月週 = 4;
曜日 = 10;
しかし結果は5
結果が2になりたい
それを修正する方法は?