zoukankan      html  css  js  c++  java
  • 家庭记账本第一次

    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);
        }
    }
  • 相关阅读:
    PaaS 7层动态路由的若干实现
    05-OC对象的内存分析
    04-类与对象的练习(第二个OC的类)
    03-类的声明和实现(第一个OC的类)
    02-类与对象的关系
    01-面向对象和面向过程
    06-BOOL类型的使用
    05-初识OC多文件编程(第4个OC程序)
    04-初识OC多文件编程(第3个OC程序)
    03-第二个OC程序
  • 原文地址:https://www.cnblogs.com/chaogehahaha/p/14915518.html
Copyright © 2011-2022 走看看