3.27

所花时间:2小时

代码量:118

博客篇:1

统计分析:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_stats);
        tv_target = findViewById(R.id.tv_target);
        tv_finish = findViewById(R.id.tv_finish);
        tv_record = findViewById(R.id.tv_record);
        bt_check = findViewById(R.id.bt_check);
        bt_check.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Dao d =new Dao();
                SharedPreferences sharedPreferences=getSharedPreferences("user",MODE_PRIVATE);
                String id=sharedPreferences.getString("id","");
                Map<String,String> map= new HashMap<>();
                try {
                    map=d.stats(id);
                } catch (SQLException e) {
                    throw new RuntimeException(e);
                }
                tv_target.setText("每月设置的目标数:"+map.get("targetNum"));
                tv_finish.setText("达成度平均值:"+map.get("finish"));
                tv_record.setText("每日学习总结的天数:"+map.get("recordNum"));
            }
        }).start();
    }
}

  

posted @ 2024-03-27 19:10  umiQa  阅读(4)  评论(0编辑  收藏  举报