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 9256987
In Process

The Archive Base Latest Questions

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

I am trying to develop a SMS counter app in which I want to

  • 0

I am trying to develop a SMS counter app in which I want to count all SMS of the present date. i don’t want to count total inbox SMS. I am using following code but not getting the exact result. It’s counting total inbox SMS.

TextView view = new TextView(this);

    Uri uriSMSURI = Uri.parse("content://sms/inbox");
    Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
    /*
    int nsm = 0;
    while(cur.moveToNext()){
    nsm+= + cur.getCount();
    }
    */
    String sms = "";

   while ( cur.moveToNext());{
     //   sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";   
   //    sms += cur.getString(2); 
        sms += "Total SMS in the INBOX : "+cur.getCount();
   }
    view.setText(sms);

    setContentView(view);

I am a new learner. 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-18T12:06:13+00:00Added an answer on June 18, 2026 at 12:06 pm
    Uri uriSMSURI = Uri.parse("content://sms/inbox");
        long now = System.currentTimeMillis();
        long last24 = now - 24*60*60*1000;//24h in millis
        String[] selectionArgs = new String[]{Long.toString(last24)};
        String selection = "date" + ">?";
        String[] projection = new String[]{"date"};
        Cursor cur = getContentResolver().query(uriSMSURI, projection, selection, selectionArgs,null);
    
        String sms = String.valueOf(cur.getCount());
    

    This is the Exact resul what i wanted thanks for giving me quick reply

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

Sidebar

Related Questions

trying to develop web form using jquery. all i need is to have several
I am trying to develop a script in Java which finds all .jar files
I am trying to develop an app for Google TV, which will detect the
I'm currently trying to develop an encryption app for Android using ECDH and BouncyCastle.
I'm trying to develop an app using Xcode 4.3.3 with iPhone 5.1 simulator. When
I am trying to develop a feature into my app to backup sms and
I am trying develop an Android app which uses Google maps. So for the
I am trying to develop an application to forward received SMS to a web
Im trying to develop my first ASP.NET MVC web app and have run into
im trying to develop an app for a win CE mobile device that downloads

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.