Skip to content Skip to sidebar Skip to footer

How To Fetch The Data From Sqlite Database And Show In Listview In Android

after login page I want show the A for Apple,B for Boy....ect upto F..in listview. But in my application i login success fully only login table is created success fully but mainmen

Solution 1:

this is the code which i am using to fetch all the values.

/*this is Database class*/

publicString getData1() throws SQLException{
        // TODO Auto-generated method stubString[] columns1 = newString[] { KEY_DATE };
        Cursor c1 = ourDatabase.query(DATABASE_MARKSTABLE, columns1, null, null, null,
                null, KEY_ENDINGTIME+" DESC", " 30");
        String result1 = "";

        int isName = c1.getColumnIndex(KEY_DATE);

        for (c1.moveToFirst(); !c1.isAfterLast(); c1.moveToNext()) {

            result1 = result1 + c1.getString(isName)
                    + "  " + "\n";

        }
        c1.close();
        return result1;

    }

and inorder to display it in the list view please check this link

http://www.technotalkative.com/android-%E2%80%93-listview-%E2%80%93-2-custom-listview/

Post a Comment for "How To Fetch The Data From Sqlite Database And Show In Listview In Android"