JAVA日报

Posted 我的未来姓栗山

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA日报相关的知识,希望对你有一定的参考价值。

换汤不换药之家庭记账本app开发(SecondActivity)

package com.example.jizhang;

import android.os.Bundle;
import android.widget.EditText;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import dao.userdao;

public class SecondActivity extends AppCompatActivity{
private EditText editTextt1;
private EditText editTextt2;
private EditText editTextt3;
private EditText editTextt4;
private EditText editTextt5;
private EditText editTextt6;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
InitData();
}
private void InitData(){
editTextt1 = (EditText) findViewById(R.id.edt_eat2);
editTextt2 = (EditText) findViewById(R.id.edt_play2);
editTextt3 = (EditText) findViewById(R.id.edt_clothes2);
editTextt4 = (EditText) findViewById(R.id.edt_live2);
editTextt5 = (EditText) findViewById(R.id.edt_usual2);
editTextt6 = (EditText) findViewById(R.id.edt_total);
userdao userDao=userdao.getInstance(getApplicationContext());
userDao.Initdata();
// for(user u:userList){
// eat=eat+Double.valueOf(u.getEat());
// play=play+Double.valueOf(u.getPlay());
// clothes=clothes+Double.valueOf(u.getClothes());
// live=live+Double.valueOf(u.getLive());
// usual=usual+Double.valueOf(u.getUsual());
// }
// userdao userDao = userdao.getInstance(getApplicationContext());
// SQLiteDatabase db=userDao.getDb().getWritableDatabase();
// Cursor cursor=db.query("tex",new String[]{"date","eat","play","clothes","live","usual"},null,null,null,null,null);
// while(cursor.moveToNext()) {
// eat = eat + Double.valueOf(cursor.getString(1));
// play = play + Double.valueOf(cursor.getString(2));
// clothes = clothes + Double.valueOf(cursor.getString(3));
// live = live + Double.valueOf(cursor.getString(4));
// usual = usual + Double.valueOf(cursor.getString(5));
// }
// total=eat+play+clothes+live+usual;

editTextt1.setText(""+userDao.eat);
editTextt2.setText(""+userDao.play);
editTextt3.setText(""+userDao.clothes);
editTextt4.setText(""+userDao.live);
editTextt5.setText(""+userDao.usual);
editTextt6.setText(""+userDao.total);
userDao.clear();
}

}

以上是关于JAVA日报的主要内容,如果未能解决你的问题,请参考以下文章

java代码在片段活动中不起作用

java 代码片段【JAVA】

CSDN日报20170413 ——《天天写业务代码的那些年,我们是如何成长过来的》

# Java 常用代码片段

# Java 常用代码片段

创建片段而不从 java 代码实例化它