ArrayList在RecyclerView中添加数据时跳过一些数据

时间:2019-07-17 06:50:39

标签: android android-recyclerview

好吧,我正在运行一个循环以获取数据...它获取了6月的所有数据..但是到2019年6月19日时,它跳过了记录并继续前进而没有将数据添加到ArrayList中。 / p>

我的代码

        this.connection = createConnection();

        Statement stmt = connection.createStatement();

        Calendar last_month_data = Calendar.getInstance();
        last_month_data.add(Calendar.MONTH, -1);
        n=last_month_data.getActualMaximum(Calendar.DAY_OF_MONTH);

        String last_month_year = new SimpleDateFormat("MMM- 
        yyyy").format(last_month_data.getTime());

        String month_name = lastMonth.getText().toString();

        for (int i = 1; i <= n; i++) {
            String date = i + "-" + last_month_year;

            ResultSet resultSet = stmt.executeQuery("Select 
            ATTN_TYPE,TO_CHAR(ATTN_TIME,'HH24:MI'),REMARK from MATTN_MAS 
            where ATTN_DATE='" + date + "' and Username='" + Username + "' 
            ORDER BY TRAN_NO DESC");

            String Attn_Type;

            SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy");
            Date d=format.parse(date);

            SimpleDateFormat fomat1=new SimpleDateFormat("EEEE");
            String weekName=fomat1.format(d);

            StringBuffer myweekDate=new StringBuffer(weekName+", "+date);
            String weekDate=myweekDate.toString();

            if (resultSet.next()) {
                while (resultSet.next()) {
                    Attn_Type = resultSet.getString(1);
                    String Time = resultSet.getString(2);
                    String Reason = resultSet.getString(3);

                    if (Attn_Type.equals("I")) {
                        String Attn_Type_In = "In";
                        String Attn_Type_Out = null;

                  StringBuilder stringBuilder = new StringBuilder("" + i);
                   String date_no = stringBuilder.toString();

                   myOptions.add(new Attendance_Data(Attn_Type_In,  
                   weekDate, Reason, i, date_no, month_name,Time));

                    } else{
                        String Attn_Type_Out = "Out";
                        String Attn_Type_In = null;
                  StringBuilder stringBuilder = new StringBuilder("" + i);
                  String date_no = stringBuilder.toString();

                  myOptions.add(new Attendance_Data(Attn_Type_Out,  
                  weekDate, Reason, i, date_no, month_name,Time));
                    }
                }
            }else {
                Attn_Type = "Absent";
                String out = null;
                String Reason=null;
                String Time=null;

                StringBuilder stringBuilder = new StringBuilder("" + i);
                String date_no = stringBuilder.toString();

                myOptions.add(new Attendance_Data(Attn_Type, weekDate,
                Reason, i, date_no, month_name,Time));
            }
        }
    }catch (Exception e){
        System.out.println("My Error"+e);
    }
}

我想要从日期1到日期30的六月的所有数据,但是如果没有给定日期的记录,则应该在ArrayList中插入“不存在”,上面的代码在所有日期都可以正常工作,但是问题是它没有添加ArrayList中2019年6月19日的数据,即使没有错误也没有显示我没有得到确切的问题是什么,请帮帮我。

Please Check this Screenshot for more details...after Thursday,20 it skips 19, Wednesday and displaying data for Tuesday

1 个答案:

答案 0 :(得分:0)

Exception in thread "main" java.lang.ArithmeticException: BigInteger not invertible.
    at java.math.MutableBigInteger.mutableModInverse(MutableBigInteger.java:1986)
    at java.math.BigInteger.modInverse(BigInteger.java:3154)
    at naive.ECDSAUtils.doublePoint(ECDSAUtils.java:41)
    at naive.ECDSAUtils.mult(ECDSAUtils.java:51)
    at naive.ECDSAUtils.main(ECDSAUtils.java:15)

..Output of above code is in below image..