SQL database not being sorted correctly into ListView









up vote
-1
down vote

favorite












I have an SQL database with multiple columns which I use with a simpleCursorAdapter to show it inside a listview. I would like to sort my database on the Integer Column COL3. I am aware of how this should be done, however, my attempts did not sort the data. I am not fully sure if I've placed it incorrectly but I would greatly appreciate the help.



DatabaseHelper.java



 @Override
public void onCreate(SQLiteDatabase db)
String createTable = "CREATE TABLE " + TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
COL2 +" TEXT, " + COL3 + " INTEGER, '" + COL4 + "' TEXT, '" + COL5 + "'INTEGER, '" + COL6 + "'INTEGER, '" + COL7 + "'INTEGER, '" + COL8 + "'INTEGER)";
db.execSQL(createTable);


@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1)
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);


public boolean addData(String item, String desc, int pri, int strat, int person, int urgen)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL2, item);
contentValues.put(COL4, desc);
contentValues.put(COL3, pri);
contentValues.put(COL6, strat);
contentValues.put(COL7, person);
contentValues.put(COL8, urgen);

String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
db.rawQuery(query, null);

Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
long result = db.insert(TABLE_NAME, null, contentValues);

//if data as inserted incorrectly it will return -1
if (result == -1)
return false;
else
return true;


public Cursor getData()
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME;
Cursor data = db.rawQuery(query, null);
return data;

public Cursor getItemID(String name)
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT " + COL1 + " FROM " + TABLE_NAME +
" WHERE " + COL2 + " = '" + name + "'";
Cursor data = db.rawQuery(query, null);
return data;

public String databaseToStringArray()
String fromColumns = new StringCOL2, COL4;
SQLiteDatabase db = getWritableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM " + TABLE_NAME + " WHERE 1 ", null);

if (cursor != null && cursor.getCount()>0)
Log.d("Event", "Records do exist");

else
Log.d("Event", "Records do not exist");



cursor.moveToFirst();
while (!cursor.isAfterLast())
cursor.moveToNext();

db.close();
return fromColumns;

}


If you would like me to elaborate or provide further information I would be happy to. Thanks in advance










share|improve this question

















  • 2




    You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
    – Mike M.
    Nov 8 at 23:23











  • @MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
    – Itsleko
    Nov 8 at 23:28










  • Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
    – G. Blake Meike
    Nov 9 at 0:44














up vote
-1
down vote

favorite












I have an SQL database with multiple columns which I use with a simpleCursorAdapter to show it inside a listview. I would like to sort my database on the Integer Column COL3. I am aware of how this should be done, however, my attempts did not sort the data. I am not fully sure if I've placed it incorrectly but I would greatly appreciate the help.



DatabaseHelper.java



 @Override
public void onCreate(SQLiteDatabase db)
String createTable = "CREATE TABLE " + TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
COL2 +" TEXT, " + COL3 + " INTEGER, '" + COL4 + "' TEXT, '" + COL5 + "'INTEGER, '" + COL6 + "'INTEGER, '" + COL7 + "'INTEGER, '" + COL8 + "'INTEGER)";
db.execSQL(createTable);


@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1)
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);


public boolean addData(String item, String desc, int pri, int strat, int person, int urgen)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL2, item);
contentValues.put(COL4, desc);
contentValues.put(COL3, pri);
contentValues.put(COL6, strat);
contentValues.put(COL7, person);
contentValues.put(COL8, urgen);

String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
db.rawQuery(query, null);

Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
long result = db.insert(TABLE_NAME, null, contentValues);

//if data as inserted incorrectly it will return -1
if (result == -1)
return false;
else
return true;


public Cursor getData()
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME;
Cursor data = db.rawQuery(query, null);
return data;

public Cursor getItemID(String name)
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT " + COL1 + " FROM " + TABLE_NAME +
" WHERE " + COL2 + " = '" + name + "'";
Cursor data = db.rawQuery(query, null);
return data;

public String databaseToStringArray()
String fromColumns = new StringCOL2, COL4;
SQLiteDatabase db = getWritableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM " + TABLE_NAME + " WHERE 1 ", null);

if (cursor != null && cursor.getCount()>0)
Log.d("Event", "Records do exist");

else
Log.d("Event", "Records do not exist");



cursor.moveToFirst();
while (!cursor.isAfterLast())
cursor.moveToNext();

db.close();
return fromColumns;

}


If you would like me to elaborate or provide further information I would be happy to. Thanks in advance










share|improve this question

















  • 2




    You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
    – Mike M.
    Nov 8 at 23:23











  • @MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
    – Itsleko
    Nov 8 at 23:28










  • Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
    – G. Blake Meike
    Nov 9 at 0:44












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have an SQL database with multiple columns which I use with a simpleCursorAdapter to show it inside a listview. I would like to sort my database on the Integer Column COL3. I am aware of how this should be done, however, my attempts did not sort the data. I am not fully sure if I've placed it incorrectly but I would greatly appreciate the help.



DatabaseHelper.java



 @Override
public void onCreate(SQLiteDatabase db)
String createTable = "CREATE TABLE " + TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
COL2 +" TEXT, " + COL3 + " INTEGER, '" + COL4 + "' TEXT, '" + COL5 + "'INTEGER, '" + COL6 + "'INTEGER, '" + COL7 + "'INTEGER, '" + COL8 + "'INTEGER)";
db.execSQL(createTable);


@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1)
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);


public boolean addData(String item, String desc, int pri, int strat, int person, int urgen)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL2, item);
contentValues.put(COL4, desc);
contentValues.put(COL3, pri);
contentValues.put(COL6, strat);
contentValues.put(COL7, person);
contentValues.put(COL8, urgen);

String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
db.rawQuery(query, null);

Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
long result = db.insert(TABLE_NAME, null, contentValues);

//if data as inserted incorrectly it will return -1
if (result == -1)
return false;
else
return true;


public Cursor getData()
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME;
Cursor data = db.rawQuery(query, null);
return data;

public Cursor getItemID(String name)
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT " + COL1 + " FROM " + TABLE_NAME +
" WHERE " + COL2 + " = '" + name + "'";
Cursor data = db.rawQuery(query, null);
return data;

public String databaseToStringArray()
String fromColumns = new StringCOL2, COL4;
SQLiteDatabase db = getWritableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM " + TABLE_NAME + " WHERE 1 ", null);

if (cursor != null && cursor.getCount()>0)
Log.d("Event", "Records do exist");

else
Log.d("Event", "Records do not exist");



cursor.moveToFirst();
while (!cursor.isAfterLast())
cursor.moveToNext();

db.close();
return fromColumns;

}


If you would like me to elaborate or provide further information I would be happy to. Thanks in advance










share|improve this question













I have an SQL database with multiple columns which I use with a simpleCursorAdapter to show it inside a listview. I would like to sort my database on the Integer Column COL3. I am aware of how this should be done, however, my attempts did not sort the data. I am not fully sure if I've placed it incorrectly but I would greatly appreciate the help.



DatabaseHelper.java



 @Override
public void onCreate(SQLiteDatabase db)
String createTable = "CREATE TABLE " + TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
COL2 +" TEXT, " + COL3 + " INTEGER, '" + COL4 + "' TEXT, '" + COL5 + "'INTEGER, '" + COL6 + "'INTEGER, '" + COL7 + "'INTEGER, '" + COL8 + "'INTEGER)";
db.execSQL(createTable);


@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1)
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);


public boolean addData(String item, String desc, int pri, int strat, int person, int urgen)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL2, item);
contentValues.put(COL4, desc);
contentValues.put(COL3, pri);
contentValues.put(COL6, strat);
contentValues.put(COL7, person);
contentValues.put(COL8, urgen);

String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
db.rawQuery(query, null);

Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
long result = db.insert(TABLE_NAME, null, contentValues);

//if data as inserted incorrectly it will return -1
if (result == -1)
return false;
else
return true;


public Cursor getData()
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME;
Cursor data = db.rawQuery(query, null);
return data;

public Cursor getItemID(String name)
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT " + COL1 + " FROM " + TABLE_NAME +
" WHERE " + COL2 + " = '" + name + "'";
Cursor data = db.rawQuery(query, null);
return data;

public String databaseToStringArray()
String fromColumns = new StringCOL2, COL4;
SQLiteDatabase db = getWritableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM " + TABLE_NAME + " WHERE 1 ", null);

if (cursor != null && cursor.getCount()>0)
Log.d("Event", "Records do exist");

else
Log.d("Event", "Records do not exist");



cursor.moveToFirst();
while (!cursor.isAfterLast())
cursor.moveToNext();

db.close();
return fromColumns;

}


If you would like me to elaborate or provide further information I would be happy to. Thanks in advance







android android-sqlite






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 at 23:12









Itsleko

154




154







  • 2




    You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
    – Mike M.
    Nov 8 at 23:23











  • @MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
    – Itsleko
    Nov 8 at 23:28










  • Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
    – G. Blake Meike
    Nov 9 at 0:44












  • 2




    You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
    – Mike M.
    Nov 8 at 23:23











  • @MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
    – Itsleko
    Nov 8 at 23:28










  • Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
    – G. Blake Meike
    Nov 9 at 0:44







2




2




You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
– Mike M.
Nov 8 at 23:23





You don't sort as you add data. You sort when you query for the records you need. That db.rawQuery() call isn't really doing anything there. That call will return a Cursor with the records sorted, and that's what you'd use for your ListView. If I'm assuming correctly, just replace the SELECT statement in getData() with the one you currently have in addData(), and remove the db.rawQuery() from addData().
– Mike M.
Nov 8 at 23:23













@MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
– Itsleko
Nov 8 at 23:28




@MikeM. Oh thanks! I didnt realise it was such a small mistake on my part. Much appreciated
– Itsleko
Nov 8 at 23:28












Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
– G. Blake Meike
Nov 9 at 0:44




Hey @MikeM. Make that an answer so that it can be accepted and that other people can find it?
– G. Blake Meike
Nov 9 at 0:44












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Your code :-



 String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
db.rawQuery(query, null);


Will extract the data into a Cursor sorted as you have specified. However, the Cursor is not used. This will have no affect on the Table itself where the data is stored where available space exists.



What you need to do include the sort (ORDER BY COL3) in the query that returns the Cursor (the getData method appears to this method) that is used as the source of the ListView.



If the above assumption is correct then the getData method could be :-



public Cursor getData()
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
return db.rawQuery(query, null);



  • Note the simpler direct return of Cursor

The above lines serve no useful purpose inside the addData method and should be removed. As such the addData method could be :-



public boolean addData(String item, String desc, int pri, int strat, int person, int urgen) 
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL2, item);
contentValues.put(COL4, desc);
contentValues.put(COL3, pri);
contentValues.put(COL6, strat);
contentValues.put(COL7, person);
contentValues.put(COL8, urgen);

Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
return (db.insert(TABLE_NAME, null, contentValues) > 0);



  • Note the simpler/alternative code for determining true or false for the return.





share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217568%2fsql-database-not-being-sorted-correctly-into-listview%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Your code :-



     String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
    db.rawQuery(query, null);


    Will extract the data into a Cursor sorted as you have specified. However, the Cursor is not used. This will have no affect on the Table itself where the data is stored where available space exists.



    What you need to do include the sort (ORDER BY COL3) in the query that returns the Cursor (the getData method appears to this method) that is used as the source of the ListView.



    If the above assumption is correct then the getData method could be :-



    public Cursor getData()
    SQLiteDatabase db = this.getWritableDatabase();
    String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
    return db.rawQuery(query, null);



    • Note the simpler direct return of Cursor

    The above lines serve no useful purpose inside the addData method and should be removed. As such the addData method could be :-



    public boolean addData(String item, String desc, int pri, int strat, int person, int urgen) 
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    contentValues.put(COL2, item);
    contentValues.put(COL4, desc);
    contentValues.put(COL3, pri);
    contentValues.put(COL6, strat);
    contentValues.put(COL7, person);
    contentValues.put(COL8, urgen);

    Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
    return (db.insert(TABLE_NAME, null, contentValues) > 0);



    • Note the simpler/alternative code for determining true or false for the return.





    share|improve this answer
























      up vote
      0
      down vote













      Your code :-



       String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
      db.rawQuery(query, null);


      Will extract the data into a Cursor sorted as you have specified. However, the Cursor is not used. This will have no affect on the Table itself where the data is stored where available space exists.



      What you need to do include the sort (ORDER BY COL3) in the query that returns the Cursor (the getData method appears to this method) that is used as the source of the ListView.



      If the above assumption is correct then the getData method could be :-



      public Cursor getData()
      SQLiteDatabase db = this.getWritableDatabase();
      String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
      return db.rawQuery(query, null);



      • Note the simpler direct return of Cursor

      The above lines serve no useful purpose inside the addData method and should be removed. As such the addData method could be :-



      public boolean addData(String item, String desc, int pri, int strat, int person, int urgen) 
      SQLiteDatabase db = this.getWritableDatabase();
      ContentValues contentValues = new ContentValues();
      contentValues.put(COL2, item);
      contentValues.put(COL4, desc);
      contentValues.put(COL3, pri);
      contentValues.put(COL6, strat);
      contentValues.put(COL7, person);
      contentValues.put(COL8, urgen);

      Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
      return (db.insert(TABLE_NAME, null, contentValues) > 0);



      • Note the simpler/alternative code for determining true or false for the return.





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Your code :-



         String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
        db.rawQuery(query, null);


        Will extract the data into a Cursor sorted as you have specified. However, the Cursor is not used. This will have no affect on the Table itself where the data is stored where available space exists.



        What you need to do include the sort (ORDER BY COL3) in the query that returns the Cursor (the getData method appears to this method) that is used as the source of the ListView.



        If the above assumption is correct then the getData method could be :-



        public Cursor getData()
        SQLiteDatabase db = this.getWritableDatabase();
        String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
        return db.rawQuery(query, null);



        • Note the simpler direct return of Cursor

        The above lines serve no useful purpose inside the addData method and should be removed. As such the addData method could be :-



        public boolean addData(String item, String desc, int pri, int strat, int person, int urgen) 
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put(COL2, item);
        contentValues.put(COL4, desc);
        contentValues.put(COL3, pri);
        contentValues.put(COL6, strat);
        contentValues.put(COL7, person);
        contentValues.put(COL8, urgen);

        Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
        return (db.insert(TABLE_NAME, null, contentValues) > 0);



        • Note the simpler/alternative code for determining true or false for the return.





        share|improve this answer












        Your code :-



         String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
        db.rawQuery(query, null);


        Will extract the data into a Cursor sorted as you have specified. However, the Cursor is not used. This will have no affect on the Table itself where the data is stored where available space exists.



        What you need to do include the sort (ORDER BY COL3) in the query that returns the Cursor (the getData method appears to this method) that is used as the source of the ListView.



        If the above assumption is correct then the getData method could be :-



        public Cursor getData()
        SQLiteDatabase db = this.getWritableDatabase();
        String query = "SELECT * FROM " + TABLE_NAME + " ORDER BY " + COL3 + " DESC";
        return db.rawQuery(query, null);



        • Note the simpler direct return of Cursor

        The above lines serve no useful purpose inside the addData method and should be removed. As such the addData method could be :-



        public boolean addData(String item, String desc, int pri, int strat, int person, int urgen) 
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put(COL2, item);
        contentValues.put(COL4, desc);
        contentValues.put(COL3, pri);
        contentValues.put(COL6, strat);
        contentValues.put(COL7, person);
        contentValues.put(COL8, urgen);

        Log.d(TAG, "addData: Adding " + item + " to " + TABLE_NAME);
        return (db.insert(TABLE_NAME, null, contentValues) > 0);



        • Note the simpler/alternative code for determining true or false for the return.






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 7:03









        MikeT

        13.5k102440




        13.5k102440



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217568%2fsql-database-not-being-sorted-correctly-into-listview%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

            Crossroads (UK TV series)

            ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế