mercredi 2 septembre 2015

Cursor Adapter displays Duplicate values

I have developed an android application that list values in a costume cursor adapter. I have used the below code to populate the values in the list view but the result queries duplicate values.

  public Cursor getInfromation()
        {

            try {

                SQLiteDatabase db_database = getReadableDatabase();

                Cursor c = db_database.rawQuery("SELECT DISTINCT Issued_ID AS _id ,warrenty,asset_name,asset_status,AssetImage FROM `Assets`,`transactionlog` WHERE Assets.Assetid = transactionlog.Assetissuedid AND asset_status =?", new String[]{"In Storage"}, null);
                if (c!= null) {
                    return c;

                } else {
                    return null;
                }

            }

            catch (Exception e)
            {

                return null;
            }

        }

Aucun commentaire:

Enregistrer un commentaire