打卡18
1.新学期目标2.打卡3.打卡24.打卡35.打卡 46.打卡57.打卡68.打卡79.打卡810.打卡911.打卡1012.结对作业(地铁查询项目)0113.结对作业(地铁项目)0214.结对作业(地铁项目)0315.结对作业(地铁项目)0416.结对作业(地铁项目)0517.结对作业(地铁项目)0618.结对作业(地铁项目)0719.结对作业(地铁项目)0820.结对作业(地铁项目)0921.结对作业(地铁项目)1022.结对作业(地铁项目)1123.结对作业(地铁项目)1224.结对作业(地铁项目)1325.结对作业(地铁项目)1426.五一冲刺(政策查询系统)127.五一冲刺(政策查询系统)228.政策查询系统(安卓)129.政策查询系统(安卓)230.政策查询系统(安卓)331.政策查询系统(安卓)432.政策查询系统(安卓)533.政策查询系统(安卓)634.政策查询系统(安卓)735.JS开发36.安卓app开发相关37.第一次个人作业(安卓学习记录系统)0138.第一次个人作业(安卓学习记录系统)0239.第一次个人作业(安卓学习记录系统)0340.第一次个人作业(安卓学习记录系统)0441.第一次个人作业(安卓学习记录系统)0542.第一次个人作业(安卓学习记录系统)0643.第一次个人作业(安卓学习记录系统)0744.打卡1145.打卡1246.打卡1347.打卡1448.打卡1549.打卡1650.打卡17
51.打卡18
52.打卡1953.打卡2054.python学习55.python学习256.python学习357.Javaweb58.打卡2159.fragment学习和使用60.mybits学习161.mybits学习262.mybits学习363.课程总结64.个人总结
所花时间(包括上课): |
2h |
代码量(行): |
150左右 |
搏客量(篇): |
1 |
了解到的知识点: |
安卓 |
备注(其他): |
package com.example.app_02;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class AnalyseActivity extends AppCompatActivity implements View.OnClickListener {
private EditText edAnalyse;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_analyse);
edAnalyse = findViewById(R.id.edAnalyse);
findViewById(R.id.btn_save).setOnClickListener(this);
}
@Override
public void onClick(View v) {
SharedPreferences sharedPreferences = getSharedPreferences("analyse", Context.MODE_PRIVATE);
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("analyse",edAnalyse.getText().toString());
editor.apply();
Intent intent = new Intent(this,FirstPageActivity.class);
startActivity(intent);
}
}
package com.example.app_02;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.TextView;
import com.example.app_02.entity.Record;
import com.example.app_02.utils.RecordDao;
import java.util.ArrayList;
public class FirstPageActivity extends AppCompatActivity implements View.OnClickListener {
private String record;
private TextView tvRecord;
private SharedPreferences sharedPreferences;
@SuppressLint({"MissingInflatedId", "SetTextI18n"})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_page);
findViewById(R.id.btnGoal).setOnClickListener(this);
findViewById(R.id.btnRecord).setOnClickListener(this);
findViewById(R.id.btnAnalyse).setOnClickListener(this);
TextView tvGoal = findViewById(R.id.tvGoal);
tvRecord = findViewById(R.id.tvRecord);
sharedPreferences = getSharedPreferences("goal", Context.MODE_PRIVATE);
String goalDate = sharedPreferences.getString("goalDate", "");
String goal = sharedPreferences.getString("goal", "");
tvGoal.setText(goalDate + " : " + goal);
sharedPreferences = getSharedPreferences("record", Context.MODE_PRIVATE);
tvRecord.setText(sharedPreferences.getString("record", ""));
//
// h = new Handler(){
// @SuppressLint("HandlerLeak")
// @Override
// public void handleMessage(){
// record = "";
// ArrayList<Record> records = new ArrayList<>();
// RecordDao recordDao = new RecordDao();
// records = recordDao.findRecord();
// for (int i = 0; i < records.size(); i++) {
// record += records.get(i).toString();
// }
// tvRecord.setText(record);
// }
// };
// Handler handler = new Handler(Looper.getMainLooper());
// handler.post(new Runnable() {
// @Override
// public void run() {
// record = "";
// ArrayList<Record> records = new ArrayList<>();
// RecordDao recordDao = new RecordDao();
// records = recordDao.findRecord();
// for (int i = 0; i < records.size(); i++) {
// record += records.get(i).toString();
// }
// tvRecord.setText(record);
// }
// });
//
// FirstPageActivity.this.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// record = "";
// ArrayList<Record> records = new ArrayList<>();
// RecordDao recordDao = new RecordDao();
// records = recordDao.findRecord();
// for (int i = 0; i < records.size(); i++) {
// record += records.get(i).toString();
// }
// tvRecord.setText(record);
// }
// });
}
protected void onResume() {
super.onResume();
sharedPreferences = getSharedPreferences("record", Context.MODE_PRIVATE);
tvRecord.setText(sharedPreferences.getString("record", ""));
// new Thread(new Runnable() {
// @Override
// public void run() {
// record = "";
// ArrayList<Record> records = new ArrayList<>();
// RecordDao recordDao = new RecordDao();
// records = recordDao.findRecord();
// for (int i = 0; i < records.size(); i++) {
// record += records.get(i).toString();
// }
// tvRecord.setText(record);
// }
// }).start();
TextView tvAnalyse = findViewById(R.id.tvAnalyse);
SharedPreferences sharedPreferences = getSharedPreferences("analyse", MODE_PRIVATE);
tvAnalyse.setText(sharedPreferences.getString("analyse", ""));
}
// public void findAll() {
// new Thread(new Runnable() {
// @Override
// public void run() {
// record = "";
// ArrayList<Record> records = new ArrayList<>();
// RecordDao recordDao = new RecordDao();
// records = recordDao.findRecord();
// for (int i = 0; i < records.size(); i++) {
// record += records.get(i).toString();
// }
// }
// }).start();
// }
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btnGoal) {
Intent intent = new Intent(this, GoalActivity.class);
startActivity(intent);
} else if (i == R.id.btnRecord) {
Intent intent = new Intent(this, RecordActivity.class);
startActivity(intent);
} else {
Intent intent = new Intent(this, AnalyseActivity.class);
startActivity(intent);
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效