每日总结 3.4

今天学习了页面listview的显示数据;

经过多次更改仍然无法获取数据库的数据。

 ListView listView=findViewById(R.id.main_lv);
        sqLiteDatabase=openOrCreateDatabase("dbs_test", Context.MODE_PRIVATE,null);
        stuHelp=Help.getStuHelp (this);
        stus=stuHelp.brose(sqLiteDatabase);
        stus.add(0,new DaKa("日期","关键字","总结","坚持","最长天数"));
        System.out.println(stus.toString());
        Adapter adapter=new Adapter(this,stus);
        listView.setAdapter(adapter);
        System.out.println(stus.toString());

       /* ListView listView = (ListView) findViewById(R.id.main_lv);
        List<Map<String,String>> dates=dbHelper.getcx();
        SimpleAdapter a=new SimpleAdapter(this,
                dates, R.layout.fragment_one_item,
                new String[]{"date","key"},
                new int[]{R.id.tv_expense_date,R.id.tv_expense_gj});
        listView.setAdapter(a);

        dbHelper=new DbHelper(MainActivity.this);*/
    }

 

posted @ 2023-03-04 21:21  一个小虎牙  阅读(6)  评论(0编辑  收藏  举报