1

クライアントから予約日を取得する保険アプリを作成しました。特定の日 (今日、明日)、週 (今日から 7 日)、月 (今日から 30 日)、および 6 か月、年の予定を表示する必要があります。

詳細を表示するカスタム アダプターを作成しました。今日と明日には機能しますが、週、月、年には何も表示されません。私を助けてください。

<html>
private void today() {
        detail.setText("Today");

        // Convert the Current Date to SimpleDateFormat

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        tdate = c.getTime();
        sdate = sdf.format(tdate);

        String sel = "select * from addclient where AppointDate='" + sdate
                + "'order by AppointTime";
        cur = db.rawQuery(sel, null);
        cur.moveToFirst();

         value();   
    }



private void week() {

        detail.setText("Week");

        // Convert the FromDate and ToDate to SimpleDateFormat

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        fdate = c.getTime();
        fromdate = sdf.format(fdate);

        // 7 days to add
        c.add(Calendar.DATE, 7);
        tdate = c.getTime();
        todate = sdf.format(tdate);

        // Checking Datebase Table

        String sel = "SELECT * FROM addclient WHERE AppointDate BETWEEN '"
                + fromdate + "' AND '" + todate + "' order by AppointDate";

        cur = db.rawQuery(sel, null);
        cur.moveToFirst();

        value();
    }



private void month() {

        detail.setText("Month");

        // Convert the FromDate and ToDate for Month to SimpleDateFormat

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        fdate = c.getTime();
        fromdate = sdf.format(fdate);

        // 1 Month to add
        c.add(Calendar.MONTH, 1);
        tdate = c.getTime();
        todate = sdf.format(tdate);

        // Checking Datebase Table
        String sel = "SELECT * FROM addclient WHERE AppointDate BETWEEN '"
                + fromdate + "' AND '" + todate + "' order by AppointDate";
        cur = db.rawQuery(sel, null);
        cur.moveToFirst();

         value();
    }



private void year() {

        detail.setText("Year");


        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        fdate = c.getTime();
        fromdate = sdf.format(fdate);

        // 1 Year to add
        c.add(Calendar.YEAR, 1);
        tdate = c.getTime();
        todate = sdf.format(tdate);

        // Checking Datebase Table
        String sel = "SELECT * FROM addclient WHERE AppointDate BETWEEN '"
                + fromdate + "' AND '" + todate + "' order by AppointDate";
        cur = db.rawQuery(sel, null);
        cur.moveToFirst();

         value();
}

public void value(){

        while (!cur.isAfterLast()) {
            count++;
            cur.moveToNext();
        }

        cur.moveToFirst();

        // Assigning count as the array length
        name = new String[count];
        address = new String[count];
        date = new String[count];
        time = new String[count];

        int i = 0;

        // Retrieve the database values 
        while (!cur.isAfterLast()) {
            String s1 = cur.getString(0).toString();
            String s2 = cur.getString(3).toString();
            String s3 = cur.getString(16).toString();
            String s4 = cur.getString(17).toString();

            name[i] = s1;
            address[i] = s2;
            date[i] = s3;
            time[i] = s4;
            i++;

            cur.moveToNext();
        }

        lv.setAdapter(new MyCustomAdapter(name, address, date, time));
}
</html>
4

0 に答える 0