码迷,mamicode.com
首页 > 其他好文 > 详细

软件总结

时间:2021-03-01 13:15:42      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:数据库对象   tin   ted   ann   from   man   led   i++   void   

2021年2月27日:

软件总结:

adapter:

package com.example.jiatingruanjian.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.jiatingruanjian.R;
import com.example.jiatingruanjian.db.AccountBean;

import java.util.Calendar;
import java.util.List;


public class AccountAdapter extends BaseAdapter {
Context context;
List<AccountBean> mDatas;
LayoutInflater inflater;
int year,month,day;
public AccountAdapter(Context context, List<AccountBean> mDatas) {
this.context = context;
this.mDatas = mDatas;
inflater = LayoutInflater.from(context);
Calendar calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
day = calendar.get(Calendar.DAY_OF_MONTH);
}

@Override
public int getCount() {
return mDatas.size();
}

@Override
public Object getItem(int position) {
return mDatas.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_mainlv,parent,false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
AccountBean bean = mDatas.get(position);
holder.typeIv.setImageResource(bean.getsImageId());
holder.typeTv.setText(bean.getTypename());
holder.beizhuTv.setText(bean.getBeizhu());
holder.moneyTv.setText("¥ "+bean.getMoney());
if (bean.getYear()==year&&bean.getMonth()==month&&bean.getDay()==day) {
String time = bean.getTime().split(" ")[1];
holder.timeTv.setText("今天 "+time);
}else {
holder.timeTv.setText(bean.getTime());
}
return convertView;
}

class ViewHolder{
ImageView typeIv;
TextView typeTv,beizhuTv,timeTv,moneyTv;
public ViewHolder(View view){
typeIv = view.findViewById(R.id.item_mainlv_iv);
typeTv = view.findViewById(R.id.item_mainlv_tv_title);
timeTv = view.findViewById(R.id.item_mainlv_tv_time);
beizhuTv = view.findViewById(R.id.item_mainlv_tv_beizhu);
moneyTv = view.findViewById(R.id.item_mainlv_tv_money);

}
}
}


package com.example.jiatingruanjian.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.jiatingruanjian.R;

import java.util.ArrayList;
import java.util.List;

/*
* 历史账单界面,点击日历表,弹出对话框,当中的GridView对应的适配器
* */
public class CalendarAdapter extends BaseAdapter {
Context context;
List<String>mDatas;
public int year;
public int selPos = -1;

public void setYear(int year) {
this.year = year;
mDatas.clear();
loadDatas(year);
notifyDataSetChanged();
}

public CalendarAdapter(Context context, int year) {
this.context = context;
this.year = year;
mDatas = new ArrayList<>();
loadDatas(year);
}

private void loadDatas(int year) {
for (int i = 1; i < 13; i++) {
String data = year+"/"+i;
mDatas.add(data);
}
}

@Override
public int getCount() {
return mDatas.size();
}

@Override
public Object getItem(int position) {
return mDatas.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.item_dialogcal_gv,parent,false);
TextView tv = convertView.findViewById(R.id.item_dialogcal_gv_tv);
tv.setText(mDatas.get(position));
tv.setBackgroundResource(R.color.grey_f3f3f3);
tv.setTextColor(Color.BLACK);
if (position == selPos) {
tv.setBackgroundResource(R.color.green_006400);
tv.setTextColor(Color.WHITE);
}
return convertView;
}
}


package com.example.jiatingruanjian.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.jiatingruanjian.R;
import com.example.jiatingruanjian.db.ChartItemBean;
import com.example.jiatingruanjian.utils.FloatUtils;

import java.util.List;


public class ChartItemAdapter extends BaseAdapter {
Context context;
List<ChartItemBean> mDatas;
LayoutInflater inflater;
public ChartItemAdapter(Context context, List<ChartItemBean> mDatas) {
this.context = context;
this.mDatas = mDatas;
inflater = LayoutInflater.from(context);
}

@Override
public int getCount() {
return mDatas.size();
}

@Override
public Object getItem(int position) {
return mDatas.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_chartfrag_lv,parent,false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
// 获取显示内容
ChartItemBean bean = mDatas.get(position);
holder.iv.setImageResource(bean.getsImageId());
holder.typeTv.setText(bean.getType());
float ratio = bean.getRatio();
String pert = FloatUtils.ratioToPercent(ratio);
holder.ratioTv.setText(pert);

holder.totalTv.setText("¥ "+bean.getTotalMoney());
return convertView;
}

class ViewHolder{
TextView typeTv,ratioTv,totalTv;
ImageView iv;
public ViewHolder(View view){
typeTv = view.findViewById(R.id.item_chartfrag_tv_type);
ratioTv = view.findViewById(R.id.item_chartfrag_tv_pert);
totalTv = view.findViewById(R.id.item_chartfrag_tv_sum);
iv = view.findViewById(R.id.item_chartfrag_iv);
}
}
}


package com.example.jiatingruanjian.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class ChartVPAdapter extends FragmentPagerAdapter {
List<Fragment>fragmentList;
public ChartVPAdapter(@NonNull FragmentManager fm, List<Fragment>fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}

@NonNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}

@Override
public int getCount() {
return fragmentList.size();
}
}


package com.example.jiatingruanjian.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class RecordPagerAdapter extends FragmentPagerAdapter {
List<Fragment>fragmentList;
String[]titles = {"支出","收入"};
public RecordPagerAdapter(@NonNull FragmentManager fm,List<Fragment>fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}
@NonNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}

@Override
public int getCount() {
return fragmentList.size();
}

@Nullable
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
}

bean:


package com.example.jiatingruanjian.db;
/** 描述记录一条数据的相关内容类*/
public class AccountBean {
int id;
String typename; //类型
int sImageId; //被选中类型图片
String beizhu; //备注
float money; //价格
String time ; //保存时间字符串
int year;
int month;
int day;
int kind; //类型 收入---1 支出---0

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getTypename() {
return typename;
}

public void setTypename(String typename) {
this.typename = typename;
}

public int getsImageId() {
return sImageId;
}

public void setsImageId(int sImageId) {
this.sImageId = sImageId;
}

public String getBeizhu() {
return beizhu;
}

public void setBeizhu(String beizhu) {
this.beizhu = beizhu;
}

public float getMoney() {
return money;
}

public void setMoney(float money) {
this.money = money;
}

public String getTime() {
return time;
}

public void setTime(String time) {
this.time = time;
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public int getMonth() {
return month;
}

public void setMonth(int month) {
this.month = month;
}

public int getDay() {
return day;
}

public void setDay(int day) {
this.day = day;
}

public int getKind() {
return kind;
}

public void setKind(int kind) {
this.kind = kind;
}

public AccountBean() {
}

public AccountBean(int id, String typename, int sImageId, String beizhu, float money, String time, int year, int month, int day, int kind) {
this.id = id;
this.typename = typename;
this.sImageId = sImageId;
this.beizhu = beizhu;
this.money = money;
this.time = time;
this.year = year;
this.month = month;
this.day = day;
this.kind = kind;
}
}

package com.example.jiatingruanjian.db;
/* 用于描述绘制柱状图时,每一个柱子表示的对象*/
public class BarChartItemBean {
int year;
int month;
int day;
float summoney;

public BarChartItemBean() {
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public int getMonth() {
return month;
}

public void setMonth(int month) {
this.month = month;
}

public int getDay() {
return day;
}

public void setDay(int day) {
this.day = day;
}

public float getSummoney() {
return summoney;
}

public void setSummoney(float summoney) {
this.summoney = summoney;
}

public BarChartItemBean(int year, int month, int day, float summoney) {
this.year = year;
this.month = month;
this.day = day;
this.summoney = summoney;
}
}


package com.example.jiatingruanjian.db;

public class ChartItemBean {
int sImageId;
String type;
float ratio; //所占比例
float totalMoney; //此项的总钱数

public ChartItemBean() {
}

public void setsImageId(int sImageId) {
this.sImageId = sImageId;
}

public void setType(String type) {
this.type = type;
}

public void setRatio(float ratio) {
this.ratio = ratio;
}

public void setTotalMoney(float totalMoney) {
this.totalMoney = totalMoney;
}

public int getsImageId() {
return sImageId;
}

public String getType() {
return type;
}

public float getRatio() {
return ratio;
}

public float getTotalMoney() {
return totalMoney;
}

public ChartItemBean(int sImageId, String type, float ratio, float totalMoney) {
this.sImageId = sImageId;
this.type = type;
this.ratio = ratio;
this.totalMoney = totalMoney;
}
}


package com.example.jiatingruanjian.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.example.jiatingruanjian.utils.FloatUtils;

import java.util.ArrayList;
import java.util.List;



public class DBManager {
private static SQLiteDatabase db;
public static void initDB(Context context){
DBOpenHelper helper = new DBOpenHelper(context); //得到帮助类对象
db = helper.getWritableDatabase(); //得到数据库对象
}
public static List<TypeBean>getTypeList(int kind){
List<TypeBean>list = new ArrayList<>();
//读取typetb表当中的数据
String sql = "select * from typetb where kind = "+kind;
Cursor cursor = db.rawQuery(sql, null);
// 循环读取游标内容,存储到对象当中
while (cursor.moveToNext()) {
String typename = cursor.getString(cursor.getColumnIndex("typename"));
int imageId = cursor.getInt(cursor.getColumnIndex("imageId"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind1 = cursor.getInt(cursor.getColumnIndex("kind"));
int id = cursor.getInt(cursor.getColumnIndex("id"));
TypeBean typeBean = new TypeBean(id, typename, imageId, sImageId, kind);
list.add(typeBean);
}
return list;
}

/*
* 向记账表当中插入一条元素
* */
public static void insertItemToAccounttb(AccountBean bean){
ContentValues values = new ContentValues();
values.put("typename",bean.getTypename());
values.put("sImageId",bean.getsImageId());
values.put("beizhu",bean.getBeizhu());
values.put("money",bean.getMoney());
values.put("time",bean.getTime());
values.put("year",bean.getYear());
values.put("month",bean.getMonth());
values.put("day",bean.getDay());
values.put("kind",bean.getKind());
db.insert("accounttb",null,values);
}
/*
* 获取记账表当中某一天的所有支出或者收入情况
* */
public static List<AccountBean>getAccountListOneDayFromAccounttb(int year,int month,int day){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where year=? and month=? and day=? order by id desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", day + ""});
//遍历符合要求的每一行数据
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String beizhu = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, beizhu, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}

/*
* 获取记账表当中某一月的所有支出或者收入情况
* */
public static List<AccountBean>getAccountListOneMonthFromAccounttb(int year,int month){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where year=? and month=? order by id desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + ""});
//遍历符合要求的每一行数据
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String beizhu = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
int day = cursor.getInt(cursor.getColumnIndex("day"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, beizhu, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}
/**
* 获取某一天的支出或者收入的总金额 kind:支出==0 收入===1
* */
public static float getSumMoneyOneDay(int year,int month,int day,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and month=? and day=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", day + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}
/**
* 获取某一月的支出或者收入的总金额 kind:支出==0 收入===1
* */
public static float getSumMoneyOneMonth(int year,int month,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and month=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}
/** 统计某月份支出或者收入情况有多少条 收入-1 支出-0*/
public static int getCountItemOneMonth(int year,int month,int kind){
int total = 0;
String sql = "select count(money) from accounttb where year=? and month=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
if (cursor.moveToFirst()) {
int count = cursor.getInt(cursor.getColumnIndex("count(money)"));
total = count;
}
return total;
}
/**
* 获取某一年的支出或者收入的总金额 kind:支出==0 收入===1
* */
public static float getSumMoneyOneYear(int year,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}

/*
* 根据传入的id,删除accounttb表当中的一条数据
* */
public static int deleteItemFromAccounttbById(int id){
int i = db.delete("accounttb", "id=?", new String[]{id + ""});
return i;
}
/**
* 根据备注搜索收入或者支出的情况列表
* */
public static List<AccountBean>getAccountListByRemarkFromAccounttb(String beizhu){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where beizhu like ‘%"+beizhu+"%‘";
Cursor cursor = db.rawQuery(sql, null);
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String bz = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
int year = cursor.getInt(cursor.getColumnIndex("year"));
int month = cursor.getInt(cursor.getColumnIndex("month"));
int day = cursor.getInt(cursor.getColumnIndex("day"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, bz, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}

/**
* 查询记账的表当中有几个年份信息
* */
public static List<Integer>getYearListFromAccounttb(){
List<Integer>list = new ArrayList<>();
String sql = "select distinct(year) from accounttb order by year asc";
Cursor cursor = db.rawQuery(sql, null);
while (cursor.moveToNext()) {
int year = cursor.getInt(cursor.getColumnIndex("year"));
list.add(year);
}
return list;
}

/*
* 删除accounttb表格当中的所有数据
* */
public static void deleteAllAccount(){
String sql = "delete from accounttb";
db.execSQL(sql);
}

/**
* 查询指定年份和月份的收入或者支出每一种类型的总钱数
* */
public static List<ChartItemBean>getChartListFromAccounttb(int year,int month,int kind){
List<ChartItemBean>list = new ArrayList<>();
float sumMoneyOneMonth = getSumMoneyOneMonth(year, month, kind); //求出支出或者收入总钱数
String sql = "select typename,sImageId,sum(money)as total from accounttb where year=? and month=? and kind=? group by typename " +
"order by total desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
while (cursor.moveToNext()) {
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
float total = cursor.getFloat(cursor.getColumnIndex("total"));
//计算所占百分比 total /sumMonth
float ratio = FloatUtils.div(total,sumMoneyOneMonth);
ChartItemBean bean = new ChartItemBean(sImageId, typename, ratio, total);
list.add(bean);
}
return list;
}

/**
* 获取这个月当中某一天收入支出最大的金额,金额是多少
* */
public static float getMaxMoneyOneDayInMonth(int year,int month,int kind){
String sql = "select sum(money) from accounttb where year=? and month=? and kind=? group by day order by sum(money) desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
return money;
}
return 0;
}

/** 根据指定月份每一日收入或者支出的总钱数的集合*/
public static List<BarChartItemBean>getSumMoneyOneDayInMonth(int year,int month,int kind){
String sql = "select day,sum(money) from accounttb where year=? and month=? and kind=? group by day";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
List<BarChartItemBean>list = new ArrayList<>();
while (cursor.moveToNext()) {
int day = cursor.getInt(cursor.getColumnIndex("day"));
float smoney = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
BarChartItemBean itemBean = new BarChartItemBean(year, month, day, smoney);
list.add(itemBean);
}
return list;
}

}


package com.example.jiatingruanjian.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

import com.example.jiatingruanjian.R;

public class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(@Nullable Context context) {
super(context,"tally.db" , null, 1);
}

// 创建数据库的方法,只有项目第一次运行时,会被调用
@Override
public void onCreate(SQLiteDatabase db) {
// 创建表示类型的表
String sql = "create table typetb(id integer primary key autoincrement,typename varchar(10),imageId integer,sImageId integer,kind integer)";
db.execSQL(sql);
insertType(db);
//创建记账表
sql = "create table accounttb(id integer primary key autoincrement,typename varchar(10),sImageId integer,beizhu varchar(80),money float," +
"time varchar(60),year integer,month integer,day integer,kind integer)";
db.execSQL(sql);
}
private void insertType(SQLiteDatabase db) {
// 向typetb表当中插入元素
String sql = "insert into typetb (typename,imageId,sImageId,kind) values (?,?,?,?)";
db.execSQL(sql,new Object[]{"其他", R.mipmap.ic_qita,R.mipmap.ic_qita_fs,0});
db.execSQL(sql,new Object[]{"餐饮", R.mipmap.ic_canyin,R.mipmap.ic_canyin_fs,0});
db.execSQL(sql,new Object[]{"交通", R.mipmap.ic_jiaotong,R.mipmap.ic_jiaotong_fs,0});
db.execSQL(sql,new Object[]{"购物", R.mipmap.ic_gouwu,R.mipmap.ic_gouwu_fs,0});
db.execSQL(sql,new Object[]{"服饰", R.mipmap.ic_fushi,R.mipmap.ic_fushi_fs,0});
db.execSQL(sql,new Object[]{"日用品", R.mipmap.ic_riyongpin,R.mipmap.ic_riyongpin_fs,0});
db.execSQL(sql,new Object[]{"娱乐", R.mipmap.ic_yule,R.mipmap.ic_yule_fs,0});
db.execSQL(sql,new Object[]{"零食", R.mipmap.ic_lingshi,R.mipmap.ic_lingshi_fs,0});
db.execSQL(sql,new Object[]{"烟酒茶", R.mipmap.ic_yanjiu,R.mipmap.ic_yanjiu_fs,0});
db.execSQL(sql,new Object[]{"学习", R.mipmap.ic_xuexi,R.mipmap.ic_xuexi_fs,0});
db.execSQL(sql,new Object[]{"医疗", R.mipmap.ic_yiliao,R.mipmap.ic_yiliao_fs,0});
db.execSQL(sql,new Object[]{"住宅", R.mipmap.ic_zhufang,R.mipmap.ic_zhufang_fs,0});
db.execSQL(sql,new Object[]{"水电煤", R.mipmap.ic_shuidianfei,R.mipmap.ic_shuidianfei_fs,0});
db.execSQL(sql,new Object[]{"通讯", R.mipmap.ic_tongxun,R.mipmap.ic_tongxun_fs,0});
db.execSQL(sql,new Object[]{"人情往来", R.mipmap.ic_renqingwanglai,R.mipmap.ic_renqingwanglai_fs,0});
db.execSQL(sql,new Object[]{"其他", R.mipmap.in_qt,R.mipmap.in_qt_fs,1});
db.execSQL(sql,new Object[]{"薪资", R.mipmap.in_xinzi,R.mipmap.in_xinzi_fs,1});
db.execSQL(sql,new Object[]{"奖金", R.mipmap.in_jiangjin,R.mipmap.in_jiangjin_fs,1});
db.execSQL(sql,new Object[]{"借入", R.mipmap.in_jieru,R.mipmap.in_jieru_fs,1});
db.execSQL(sql,new Object[]{"收债", R.mipmap.in_shouzhai,R.mipmap.in_shouzhai_fs,1});
db.execSQL(sql,new Object[]{"利息收入", R.mipmap.in_lixifuji,R.mipmap.in_lixifuji_fs,1});
db.execSQL(sql,new Object[]{"投资回报", R.mipmap.in_touzi,R.mipmap.in_touzi_fs,1});
db.execSQL(sql,new Object[]{"二手交易", R.mipmap.in_ershoushebei,R.mipmap.in_ershoushebei_fs,1});
db.execSQL(sql,new Object[]{"意外所得", R.mipmap.in_yiwai,R.mipmap.in_yiwai_fs,1});
}
// 数据库版本在更新时发生改变,会调用此方法
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

package com.example.jiatingruanjian.db;
/*
* 表示收入或者支出具体类型的类
* */
public class TypeBean {
int id;
String typename; //类型名称
int imageId; //未被选中图片id
int simageId; //被选中图片id
int kind; //收入-1 支出-0

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getTypename() {
return typename;
}

public void setTypename(String typename) {
this.typename = typename;
}

public int getImageId() {
return imageId;
}

public void setImageId(int imageId) {
this.imageId = imageId;
}

public int getSimageId() {
return simageId;
}

public void setSimageId(int simageId) {
this.simageId = simageId;
}

public int getKind() {
return kind;
}

public void setKind(int kind) {
this.kind = kind;
}

public TypeBean() {
}

public TypeBean(int id, String typename, int imageId, int simageId, int kind) {
this.id = id;
this.typename = typename;
this.imageId = imageId;
this.simageId = simageId;
this.kind = kind;
}
}



软件总结

标签:数据库对象   tin   ted   ann   from   man   led   i++   void   

原文地址:https://www.cnblogs.com/yitiaokuailedexiaojingyu/p/14457073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!