换汤不换药之家庭记账本app开发(FirstActivity)
package com.example.jizhang;
import android.os.Bundle;
import android.widget.ListView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import java.util.List;
import adapter.UserListAdapter;
import bean.user;
import dao.userdao;
public class FirstActivity extends AppCompatActivity {
private ListView mUserList;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
mUserList=findViewById(R.id.user_list);
InitData();
}
private void InitData(){
userdao userDao=userdao.getInstance(getApplicationContext());
List<user> userList=userDao.findAll();
UserListAdapter adapter=new UserListAdapter(getApplicationContext(),userList);
mUserList.setAdapter(adapter);
}
}