How to retrieve data from sqlite database in android and display it in TextView

后端 未结 5 554
攒了一身酷
攒了一身酷 2020-11-27 07:10

I am learning Android. I have a problem and I can\'t solve it. I want to retrieve data from an existing database and display it in a TextView after click button

5条回答
  •  遥遥无期
    2020-11-27 07:36

    You may use this following code actually it is rough but plz check it out

    db = openOrCreateDatabase("sms.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
    Cursor cc = db.rawQuery("SELECT * FROM datatable", null);
    final ArrayList row1 = new ArrayList();
    final ArrayList row2 = new ArrayList();
    
    if(cc!=null) {
        cc.moveToFirst();   
        startManagingCursor(cc);
        for (int i=0; i

提交回复
热议问题