GreenDao和Adapter实现学生信息管理

添加依赖:

implementation 'org.greenrobot:greendao:3.1.0'

implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

implementation "com.daimajia.swipelayout:library:1.2.0@aar"

 

 

app中的build.gradle

apply plugin: 'com.android.application'

apply plugin: 'org.greenrobot.greendao'

android {

    compileSdkVersion 27

    defaultConfig {

        applicationId "com.wanghuanlong.studentinformatica"

        minSdkVersion 22

        targetSdkVersion 27

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }





    greendao {

        schemaVersion 1

        targetGenDir 'src/main/java'

    }

}



dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:27.1.0'

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'com.android.support.test:runner:1.0.1'

    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation 'org.greenrobot:greendao:3.1.0'



    implementation 'com.jakewharton:butterknife:8.5.1'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'



    implementation "com.daimajia.swipelayout:library:1.2.0@aar"



}

 

 

 

model中

 

@Entity

public class Student implements Serializable{



    private String headSculpture;//头像

    @Id

    private String stuid;//学号

    private String ID;//身份证号码

    @Property(nameInDb = "name")

    private String name;//姓名

    private String age;//年龄

    private Date datOfBirth;//出生日期

    private String gender;//性别

    private String fromClass;//班级

    private String hobby;//爱好

    private String EmotionalState;//情感状态

    private String WordOfMouth;//口头禅

    private String phone;//手机号

    private String QQ;//QQ号

    private String weichat;//微信

    private String email;//电子邮箱

    private String PhotosOfLife1;//生活照1

    private String PhotosOfLife2;//生活照2

    private String PhotosOfLife3;//生活照3



    public String getPhotosOfLife1() {

        return PhotosOfLife1;

    }



    public void setPhotosOfLife1(String photosOfLife1) {

        PhotosOfLife1 = photosOfLife1;

    }



    public String getPhotosOfLife2() {

        return PhotosOfLife2;

    }



    public void setPhotosOfLife2(String photosOfLife2) {

        PhotosOfLife2 = photosOfLife2;

    }



    public String getPhotosOfLife3() {

        return PhotosOfLife3;

    }



    public void setPhotosOfLife3(String photosOfLife3) {

        PhotosOfLife3 = photosOfLife3;

    }



    private String detailedIntroduction;//详细介绍

    private int NumberOfFans;//粉丝数



    @Generated(hash = 167811149)

    public Student(String headSculpture, String stuid, String ID, String name,

            String age, Date datOfBirth, String gender, String fromClass,

            String hobby, String EmotionalState, String WordOfMouth, String phone,

            String QQ, String weichat, String email, String PhotosOfLife1,

            String PhotosOfLife2, String PhotosOfLife3,

            String detailedIntroduction, int NumberOfFans) {

        this.headSculpture = headSculpture;

        this.stuid = stuid;

        this.ID = ID;

        this.name = name;

        this.age = ag
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值