• 家庭记账本第一次


    package com.example.jizhangben;
    
    import android.content.Intent;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.ListView;
    import androidx.appcompat.app.AppCompatActivity;
    
    public class MainActivity extends AppCompatActivity implements View.OnClickListener  {
        private CostDB mCostDB;
        private CostListAdapter mAdapter;
        private SQLiteDatabase dbReader;
        private ListView costList;
        private Intent i;
        private Button bt_shouru,bt_zhichu;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.content_main);
    
            initCost();
    
        }
        private void initCost() {
            mCostDB=new CostDB(this);
            bt_shouru = (Button)this.findViewById(R.id.fabt_shouru);
            bt_zhichu = (Button)this.findViewById(R.id.fabt_zhichu);
            costList = (ListView)this.findViewById(R.id.lv_list);
            dbReader = mCostDB.getReadableDatabase();
        }
        public void selectDB(){
            Cursor cursor = dbReader.query(CostDB.TABLE_NAME,null,null,null,null,null,null);
            mAdapter = new CostListAdapter(this,cursor);
            costList.setAdapter(mAdapter);
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            selectDB();
        }
    
        @Override
        public void onClick(View v) {
            i=new Intent(this,addcost.class);
            startActivity(i);
        }
    }
  • 相关阅读:
    常见限流算法
    spring aop 事物
    Java序列化和反序列化为什么要实现Serializable接口
    java类在何时被加载?
    mysql 排序 是怎么工作的?
    程序员转正述职报告
    .NET中使用Channel<T>
    .NET-服务承载系统(Hosting)(支持Cron表达式)
    JObject拼接Json字符串
    NET5 使用FTP发布
  • 原文地址:https://www.cnblogs.com/chaogehahaha/p/14915518.html
Copyright © 2020-2023  润新知