77范文网 - 专业文章范例文档资料分享平台

个人理财小助手智能终端系统及应用开发(2)

来源:网络收集 时间:2019-03-22 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

出。用户可根据需求选择对应图标。

数据传输:在于各个功能模块交互时,使用Intent传输用户的id以便保存、读取相关的用户信息。

跳转部分代码:

publicvoid onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { Intent intent = null;// 创建Intent对象 switch (arg2) {//界面跳转 case 0:

intent = new Intent(MainActivity.this, AddOutaccount.class);// 使用AddOutaccount窗口初始化Intent

startActivity(intent);// 打开AddOutaccount break; case 1:

intent = new Intent(MainActivity.this, Addinaccount.class);// 使用AddInaccount窗口初始化Intent

startActivity(intent);// 打开AddInaccount break; case 2:

intent = new Intent(MainActivity.this, Outaccountinfo.class);// 使用Outaccountinfo窗口初始化Intent

startActivity(intent);// 打开Outaccountinfo break; case 3:

intent = new Intent(MainActivity.this, Inaccountinfo.class);// 使用Inaccountinfo窗口初始化Intent

startActivity(intent);// 打开Inaccountinfo break; case 4:

intent = new Intent(MainActivity.this, Showinfo.class);// 使用Showinfo窗口初始化Intent

startActivity(intent);// 打开Showinfo break; case 5:

intent = new Intent(MainActivity.this, Sysset.class);// 使用Sysset窗口初始化Intent startActivity(intent);// 打开Sysset break; case 6:

intent = new Intent(MainActivity.this, Accountflag.class);// 使用Accountflag窗口初始化Intent

startActivity(intent);// 打开Accountflag break; case 7:

finish();// 关闭当前Activity }

}

3:新增支出界面:此界面的功能是添加用户支出的信息,用户可添加的信息包括金额、时间、类别、地点、备注。其中时间可以读取系统当前时间,更加方便。类别提供购物、正餐、零食水果、药效、外卖、打的、其他一些选项。

这一界面总体使用LinearLayout布局,时间,金额等及其输入框使用RelativeLayout布局。类别对应的下拉框使用Spinner。

保存按钮对应代码:若金额不为空,点击保存按钮则保存数据,显示“【新增支出】数据添加成功”,若金额为空,则提示:“请输入支出金额”。

btnSaveButton.setOnClickListener(new OnClickListener(){

@Override

publicvoid onClick(View arg0){

String strMoney=txtMoney.getText().toString(); if(!strMoney.isEmpty()){//判断金额不为空

//创建OutaccountDAO对象

OutaccountDAO outaccountDAO=new OutaccountDAO(AddOutaccount.this); Tb_outaccount tb_outaccount=new Tb_outaccount(outaccountDAO.getMaxId()

+1,Double.parseDouble(strMoney),

txtTime.getText().toString(),

spType.getSelectedItem().toString(),txtAddress.getText().toString(), txtMark.getText().toString());

outaccountDAO.add(tb_outaccount);

Toast.makeText(AddOutaccount.this,\新增支出]数据添加成功!

\,Toast.LENGTH_SHORT).show();

finish();

}else{

Toast.makeText(AddOutaccount.this,\请输入支出金

额!\,Toast.LENGTH_SHORT).show();

} });

}

取消按钮对应代码:讲数据全部重置为零后退出。

btnCancelButton.setOnClickListener(new OnClickListener(){

@Override

publicvoid onClick(View arg0){

txtMoney.setText(\);//设置金额文本框为空 txtMoney.setHint(\);//为金额文本框设置提示 txtTime.setText(\);//设置时间文本框为空 txtMoney.setHint(\); txtAddress.setText(\); txtMark.setText(\); spType.setSelection(0);

finish();

} });

4:新增收入界面:此界面的功能是添加用户收入的信息,用户可添加的信息包括金额、时间、类别、付款方、备注。其中时间可以读取系统当前时间。类别提供工资、兼职、奖金、礼金、销售款、报销款等一些选项。

这一界面总体使用LinearLayout布局,时间,金额等及其输入框使用

RelativeLayout布局。类别对应的下拉框使用Spinner。与新增支出界别类同

5:我的支出界面:用于用户查询支出信息,在新增支出界面添加信息后,在此界面就可以进行显示,同时也可点击进入进行修改删除操作。

这一界面主要是使用ListView控件。

protectedvoid onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.outaccountinfo);// 设置布局文件

lvinfo = (ListView) findViewById(R.id.lvoutaccountinfo);// 获取布局文件中的ListView组件 ShowInfo(R.id.lvoutaccountinfo);// 调用自定义方法显示支出信息

lvinfo.setOnItemClickListener(new OnItemClickListener()// 为ListView添加项单击事件 { // 覆写onItemClick方法 @Override

publicvoid onItemClick(AdapterView parent, View view, int position, long id) {

String strInfo = String.valueOf(((TextView) view).getText());// 记录支出信息

String strid = strInfo.substring(0, strInfo.indexOf('|'));// 从支出信息中截取支出编号 Intent intent = new Intent(Outaccountinfo.this, InfoManage.class);// 创建Intent对象 intent.putExtra(FLAG, new String[] { strid, strType });// 设置传递数据 startActivity(intent);// 执行Intent操作 } });

}

privatevoid ShowInfo(int intType) {// 用来根据传入的管理类型,显示相应的信息 String[] strInfos = null;// 定义字符串数组,用来存储支出信息 ArrayAdapter arrayAdapter = null;// 创建ArrayAdapter对象 strType = \;// 为strType变量赋值

OutaccountDAO outaccountinfo = new OutaccountDAO(Outaccountinfo.this);// 创建OutaccountDAO对象 // 获取所有支出信息,并存储到List泛型集合中

List listoutinfos = outaccountinfo.getScrollData(0, (int) outaccountinfo.getCount());

strInfos = new String[listoutinfos.size()];// 设置字符串数组的长度 int i = 0;// 定义一个开始标识

for (Tb_outaccount tb_outaccount : listoutinfos) {// 遍历List泛型集合 // 将支出相关信息组合成一个字符串,存储到字符串数组的相应位置

strInfos[i] = tb_outaccount.getid() + \ + tb_outaccount.getType() + \ + String.valueOf(tb_outaccount.getMoney()) + \元 \ + tb_outaccount.getTime(); i++;// 标识加1 }

// 使用字符串数组初始化ArrayAdapter对象

arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, strInfos);

lvinfo.setAdapter(arrayAdapter);// 为ListView列表设置数据源

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库个人理财小助手智能终端系统及应用开发(2)在线全文阅读。

个人理财小助手智能终端系统及应用开发(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/540594.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: