zoukankan      html  css  js  c++  java
  • 家庭记账本第六次开发

    package com.example.jizhangben;
    
    import android.content.Context;
    import android.database.Cursor;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.LinearLayout;
    import android.widget.TextView;
    
    import java.util.List;
    
    class CostListAdapter extends BaseAdapter {
        private List<costBean> mlist;
        private Context mContext;
        private LayoutInflater mlayoutInflater;
        private Context context;
        private Cursor cursor;
        private LinearLayout layout;
    
        public CostListAdapter(Context context, Cursor cursor) {
            this.mContext = context;
            this.cursor = cursor;
        }
    
        @Override
        public int getCount() {
            return cursor.getCount();
        }
    
        @Override
        public Object getItem(int position) {
            return cursor.getPosition();
        }
    
        @Override
        public long getItemId(int position) {
            return position;
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(context);
            layout = (LinearLayout) inflater.inflate(R.layout.list_item, null);
            TextView moneytv = layout.findViewById(R.id.tv_cost);
            TextView datatv = layout.findViewById(R.id.tv_date);
            TextView titletv = layout.findViewById(R.id.tv_title);
            cursor.moveToPosition(position);
            String money = cursor.getString(cursor.getColumnIndex("money"));
            String data = cursor.getString(cursor.getColumnIndex("data"));
            String title = cursor.getString(cursor.getColumnIndex("title"));
            moneytv.setText(money);
            datatv.setText(data);
            titletv.setText(title);
            return layout;
        }
    }
  • 相关阅读:
    log4j在eclipse下使用
    Java实现IOS推送(利用javapns1.6)
    [转]浅谈多核CPU、多线程与并行计算
    关于select的字段加别名的语法
    [转]maven环境快速搭建
    Java实现IOS推送(Javapns2.2)
    千年服务器GM命令及使用详解
    [转载 蓝韦巍]类似浩方、VS对战平台系统的实现
    召唤和删除怪物程序段
    WPE下载 & WPE & 各版本下载 及 教程
  • 原文地址:https://www.cnblogs.com/chaogehahaha/p/14915570.html
Copyright © 2011-2022 走看看