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

  • SEARCH
  • Home
  • 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 8560693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:20:06+00:00 2026-06-11T16:20:06+00:00

I am trying to query data from sqlite db through CursorLoader. When i go

  • 0

I am trying to query data from sqlite db through CursorLoader. When i go through the documentation in android developer website, i can’t find the limit query.

CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

How can i implement limit in CursorLoader?

Thanks in Advance

  • 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-11T16:20:07+00:00Added an answer on June 11, 2026 at 4:20 pm

    The hackish way:

    String sortOrder = "ROWID LIMIT 5"
    

    which will result in ORDER BY ROWID LIMIT 5. ROWID would sort by the implicit row ids that SQLite keeps – very close to what happens when you don’t specify a sort oder at all.
    Not that this is abusing the fact that the order parameter does not check if the supplied value is just a valid order type. Kind of a buffer overflow attack.

    A better way would be to define Uri parameters.

    // query code
    Uri queryUri = Uri.parse("content://what/ever/items");
    queryUri = queryUri.buildUpon().appendQueryParameter("limit", "5").build();
    
    // in ContentProvider
    String limit = queryUri.getQueryParameter("limit");
    

    Both approaches will only work if the ContentProvider is compatible with above attempts to limit. There is actually no well-defined way to limit or select certain data from a ContentProvider. Each ContentProvider comes with it’s own contract so above will not work with every provider.

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

Sidebar

Related Questions

I am trying to write a query for retrieving data from SQLite database. I
I am trying to query data from my app, through postgresql DB. What I
I am trying to retrieve data using query from the sqlite database that was
I am trying to do a simple AJAX function to send data from query
I am trying to get my data from a query string, but use it
I'm trying to fetch the XML data from a query to the api without
I am trying to graph data that I am pulling from an ActiveRecord query
I am trying to export the following data in the query from ms sql
i'm trying the following MySQL query to fetch some data: SELECT m.*, t.* FROM
I am trying to query data from two tables into one tables using OUTER

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.