Android 数据存储

朋友圈动态查询
该方法实现了从数据库中查询并返回所有个人朋友圈动态及对应的评论信息。通过遍历查询结果,为每条动态附加其相关的评论及其文件路径,便于进一步展示或操作。整个过程涉及到了数据库操作、集合处理等技术点。

这里写图片描述
//朋友圈-个人动态-

        public ArrayList<BlogInfo> getBlogMymatesInfosList() {
            ArrayList<BlogInfo> list = new ArrayList<BlogInfo>();
            try {
                list = (ArrayList<BlogInfo>) db.findAll(BlogInfo.class);
                System.out.println("list: "+list.size());
                for (BlogInfo myclassmateInfo : list) {
                    System.out.println("where:"+myclassmateInfo.getId());
                    String strWhere = String.format("Id = '%s' ", myclassmateInfo.getId());
                    myclassmateInfo.setCommentList((ArrayList<BlogComments>) db.findAllByWhere(BlogComments.class, strWhere));

                    for (BlogComments mBlogComments: myclassmateInfo.getCommentList()) {
                        String strWhere1 = String.format("Id = '%s' ", mBlogComments.getId());
                        mBlogComments.setFilePathList((ArrayList<BlogFilePath>) db.findAllByWhere(BlogFilePath.class, strWhere1));
                    }
                    System.out.println("list in commonCourses: "+myclassmateInfo.getCommentList().size());          
                }
            } catch (Exception e) {
                e.printStackTrace();
                list = null;
            }
            return list;
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值