2024.3.27(周三)进度

完成python作业7 文件

继续写android

package com.example.learningrecords;

import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;


import com.example.learningrecords.R;
import com.example.learningrecords.entity.StatisticData;
import java.util.ArrayList;

public class Statistics extends AppCompatActivity {

private TextView titleTextView;
private TextView statisticsTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statistics);

// 初始化 TextView
titleTextView = findViewById(R.id.title);
statisticsTextView = findViewById(R.id.statistics);

// 获取传入的统计数据
ArrayList<StatisticData> statisticDataList = getIntent().getParcelableArrayListExtra("statisticDataList");
if (statisticDataList != null && !statisticDataList.isEmpty()) {
// 只显示第一条统计数据,你也可以根据需求进行修改
StatisticData statisticData = statisticDataList.get(0);

// 设置标题和统计信息
titleTextView.setText("统计分析信息如下:");
String statisticsInfo = "学生ID:" + statisticData.getStudentId() +
"\n设定目标次数:" + statisticData.getSetGoal() +
"\n学习打卡次数:" + statisticData.getSetRecord() +
"\n完成度百分比:" + statisticData.getCompletionPercentage();
statisticsTextView.setText(statisticsInfo);
} else {
// 如果未传入任何统计数据,显示提示信息
titleTextView.setText("统计分析信息如下:");
statisticsTextView.setText("没有收到统计数据");
}
}
}

 

posted @ 2024-04-08 21:30  记得关月亮  阅读(2)  评论(0编辑  收藏  举报