• 【团队】 冲刺一(8/10)


    昨天所做:显示SQLite中内容到主页面

    代码是冲刺完才粘的,可能会和所说的有所不同

      //显示账单
        public List<BillBean> showBill(List<BillBean> billlist)
        {
            Cursor cursor = mDB.query(TABLE_NAME,null,null,null,null,null,null);
            cursor.moveToLast();
            if(cursor != null && cursor.getCount() > 0) {
                do {
                    BillBean billBeanshow = new BillBean(cursor.getInt(0), cursor.getDouble(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5));
                    billlist.add(billBeanshow);
                } while (cursor.moveToPrevious());
            }
            cursor.close();
            return billlist;
        }
    package com.example.accountbook;
    
    import android.content.Context;
    import android.graphics.Color;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.ArrayAdapter;
    import android.widget.TextView;
    
    import java.util.List;
    
    public class BillAdapter extends ArrayAdapter<BillBean> {
    
        private int resourceId;
    
        public BillAdapter(Context context, int textViewResourceId, List<BillBean> objucts)
        {
            super(context,textViewResourceId,objucts);
            resourceId = textViewResourceId;
        }
    
        public View getView(int position, View convertView, ViewGroup parent)
        {
            BillBean billBean = getItem(position);
            View view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
            TextView tv_money = view.findViewById(R.id.tv_money);
            TextView tv_sort = view.findViewById(R.id.tv_sort);
            TextView tv_time = view.findViewById(R.id.tv_time);
    
            //整型
            double mo = billBean.getMoney();
            int mon = (int) mo;
    
            tv_money.setText(String.valueOf(mon));
    
            tv_sort.setText(billBean.getSort());
            tv_time.setText(billBean.getTime());
    
            //money颜色
            String c = billBean.getChoose();
            if(c.equals("支出"))
            {
                tv_money.setTextColor(Color.parseColor("#da0101"));
            }else if(c.equals("收入"))
            {
                tv_money.setTextColor(Color.parseColor("#18cb00"));
            }
    
            return view;
        }
    
    }

    今天将做:实现主页面ListView连接SQLite的长按删除操作

    遇到问题:— —

  • 相关阅读:
    springmvc文件上传 并读取excel文件基本写法 多文件时参数为 @RequestParam MultipartFile[] myfiles 单文件时直接传File
    谷歌浏览器 js调试方法
    jxl实现文件导入页面例子
    angularjs实现上传文件动态显示文件列表
    文件上传 多个文件上传与单个文件上传
    angularjs实现动态表格的删除与增加
    2017songyunxin
    百万数据导出
    OutProductController
    DownloadUtil
  • 原文地址:https://www.cnblogs.com/gothic-death/p/10933380.html
Copyright © 2020-2023  润新知