Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:45:18+00:00 2026-06-11T12:45:18+00:00

I am filling a ListView with data from my SQLite Database using a SimpleCursorAdapter.

  • 0

I am filling a ListView with data from my SQLite Database using a SimpleCursorAdapter. The data is fine but the latest entry is always inserted at the bottom of the ListView and I want to have it at the top.

I already found this post but I don`t know how to import this to my project.
At the moment my SQL query looks like this:

public Cursor fetchAllProjects() {

  Cursor mCursor = mDb.query(SQLITE_TABLE, new String[] {KEY_ROWID,
    KEY_ROUTERIP, KEY_PROJECTNAME, KEY_URL, KEY_CALIMERO}, 
    null, null, null, null, null);

  if (mCursor != null) {
   mCursor.moveToFirst();
  }
  return mCursor;
}

What do I have to change to see the ListView in descending order? Or do I have to change something at my SimpleCursorAdapter?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:45:19+00:00Added an answer on June 11, 2026 at 12:45 pm

    When running the query, the 2nd to last parameter (null at the moment) is the Order By parameter: https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#query%28boolean,%20java.lang.String,%20java.lang.String%5B%5D,%20java.lang.String,%20java.lang.String%5B%5D,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29

    You’d need to pick the column by which you want to sort, and change that. To be safe, you should probably explicitly sort in both “normal” and “reverse” order, to be sure that it is ordering by the same column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my applicatio i have 1 listview,filling data from database using arrayadapter. Here is
I am filling in my listview with a SimpleCursorAdapter . By using getView() I
I´m filling a listbox with a specific data, the code works fine, but I
I'm filling an XML document manually using C# and I need to have <data>
I am filling a GridView with the data table but on each row I
I'm filling in a Word template with data that's been collected from user input.
i have an app that is showing data in listview ,but i want first
I'm trying to bind data from my SQLiteDatabase to a ListView . I'm currently
I have filled the listview using the code given below, but I'm unablee to
Currently my ListView is filling up with the given String[] but I wanted to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.