我可以不使用字符串数组将数据库显示给微调器还是自动更正?

时间:2019-07-22 21:47:14

标签: java android android-spinner autocompletetextview

这是我的数据库,有人可以告诉我如何微调或自动更正mydatabase吗?

@Database(entities = {NotePelanggan.class}, version = 1)
public abstract class Pelanggandatabase extends RoomDatabase {

    private static Pelanggandatabase instance;

    public abstract PelangganDao pelangganDao();**strong text**

    public static synchronized Pelanggandatabase getInstance(Context context) {
        if (instance == null){
            instance = Room.databaseBuilder(context.getApplicationContext(),
                    Pelanggandatabase.class, "pelanggan_database")
                    .fallbackToDestructiveMigration()
                    .addCallback(roomCallback)
                    .build();
        }
        return instance;
    }

    private static Callback roomCallback = new Callback(){
        @Override
        public void onCreate(@NonNull SupportSQLiteDatabase db) {
            super.onCreate(db);
            new PopulateDbAsyncTask(instance).execute();
        }
    };

    private static class PopulateDbAsyncTask extends AsyncTask<Void, Void, Void> {
        private PelangganDao pelangganDao;

        private PopulateDbAsyncTask(Pelanggandatabase db){
            pelangganDao = db.pelangganDao();
        }

        @Override
        protected Void doInBackground(Void... voids) {

            return null;
        }
    }

}

0 个答案:

没有答案