How to set each item retrieved from SQLite database into a Textview of it's own

前端 未结 1 1600
忘掉有多难
忘掉有多难 2021-01-29 08:38

For now, I have a database with a single table having a single column of type TEXT. I want to be able to retrieve the data from that table and for each string from the table I w

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 09:10

    try this

    Fetch data from Database in Cursor and pass this cursor in below method it will return a view which you can pass in setContentView(view)

     public LinearLayoutCompat defaultPage(Cursor mCursor) {
            LinearLayoutCompat layout = new LinearLayoutCompat(this);
    
            layout.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayoutCompat.LayoutParams.MATCH_PARENT));
            layout.setGravity(Gravity.CENTER);
            layout.setOrientation(LinearLayoutCompat.VERTICAL); 
            for(int i=0;i

    0 讨论(0)
提交回复
热议问题