首页 > 其他分享 >6月4日小组会议

6月4日小组会议

时间:2023-06-04 19:58:11浏览次数:18  
标签:小组会议 广播 contentValues money put new intent

监听提交按钮,将用户输入和选择的信息存入数据库,提交完成后发送广播给自定义的广播接收者,然后跳转到主页,主页创建自定义广播接收者对象,调用其方法完成广播信息的展示:

submit_btn.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View v) {

        String iMoney = inMoney.getText().toString();

        String iBeizhu = inBeizhu.getText().toString();

        String time = inTime.getText().toString();

        if ("".equals(iMoney)){

            Toast.makeText(RecordActivityIn.this,"请输入金额再提交!",Toast.LENGTH_LONG).show();

        }else {

            Integer money = Integer.parseInt(iMoney);

            DatabaseHelper databaseHelper = new DatabaseHelper(RecordActivityIn.this);

            ContentValues contentValues = new ContentValues();

            contentValues.put("money",money);

            contentValues.put("remark",iBeizhu);

            contentValues.put("type",inType);

            contentValues.put("img",inTypeImg);

            contentValues.put("time",time);

            contentValues.put("io",1);

            databaseHelper.insert("allrecord",contentValues);

            //创建Intent对象,设置action属性并发送自定义广播

            Intent intent = new Intent(RecordActivityIn.this,MainActivity.class);

            intent.setAction("transfer");

            intent.putExtra("trans",inType+"收入"+money+"元!");

            sendBroadcast(intent);

            startActivity(intent);

        }

    }

});

标签:小组会议,广播,contentValues,money,put,new,intent
From: https://www.cnblogs.com/yequsanzhu/p/17456184.html

相关文章

  • 第一次小组会议记录
    在会议前我们小组有了个大概的方向,即交易平台,在此基础上我们经过讨论得出三个方向,即电商购物平台、二手物品交易平台、虚拟物品交易平台。为了更好地确定项目的方向,我们分......