01每日打卡 3月20日
今天开始了学习记录功能开发,这个难点在于如何利用数据库对录入的数据进行计算和综合。
package com.example.myapplication;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class add extends AppCompatActivity {
Button add,back,aim;
Button clock,query;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add1);
aim = this.findViewById(R.id.aim);
add = this.findViewById(R.id.add);
clock=this.findViewById(R.id.clock);
query=this.findViewById(R.id.query);
back=this.findViewById(R.id.back);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(add.this,addData.class);
startActivity(intent);
Toast.makeText(add.this,"添加数据!",Toast.LENGTH_SHORT).show();
}
});
clock.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(add.this,ClockActivity.class);
startActivity(intent);
Toast.makeText(add.this,"设置闹钟",Toast.LENGTH_SHORT).show();
}
});
query.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(add.this,queryActivity.class);
startActivity(intent);
Toast.makeText(add.this,"查询数据",Toast.LENGTH_SHORT).show();
}
});
aim.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(add.this,addMudi.class);
startActivity(intent);
Toast.makeText(add.this,"目标设定",Toast.LENGTH_SHORT).show();
}
});
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(add.this,MainActivity.class);
startActivity(intent);
Toast.makeText(add.this,"返回",Toast.LENGTH_SHORT).show();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".addData">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_editor_absoluteX="135dp"
tools:layout_editor_absoluteY="342dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="日期" >
</TextView>
<EditText
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="关键字:" />
<EditText
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="每日总结:" />
<EditText
android:id="@+id/zongjie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
<Button
android:id="@+id/submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="提交" />
<Button
android:id="@+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="返回"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· winform 绘制太阳,地球,月球 运作规律
· 上周热点回顾(3.3-3.9)