私の古いアプリの一部は廃止されましたが、再構築しようとしています。基本的には月表示のカレンダーです。GridViewのCalendarビュー
public View getView(int position, View view, ViewGroup parent) {
Date date = getItem(position);
int day = date.getDate();
int month = date.getMonth();
int year = date.getYear();
}
とint day = date.getDate(); int month = date.getMonth(); int year = date.getYear();
が廃止されました: これは私のGridViewのアダプタの一部です。 Date
の代わりにCalendar
クラスを使用しようとしていますが、同じことができません。私は日、月または年取得のために、私はこれを使用することができることを知っている:
Calendar calendar = Calendar.getInstance();
calendar.get(Calendar.DAY_OF_MONTH);
が、私はこの行を変換する方法がわからない:
Date date = getItem(position);
Calendar
で使用します。ここで
ありがとう、カレンダーオブジェクトでのみDateオブジェクトを使用しないと「ネイティブ」にできないのですか? –
問題ありません。 'Date'を使いたくない場合は、アダプタデータセットを' Calendar'に変更し、 'getItem()'を 'Calendar'を返すようにする必要があります。 – 345