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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:53:15+00:00 2026-06-06T21:53:15+00:00

How can I search the sms inbox and show latest message from a special

  • 0

How can I search the sms inbox and show latest message from a special number. For example search for “999999999” and show last message received from this number. Is any way to do this?

I have use this code to return the count of messages my inbox

TextView view;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

  view = (TextView) findViewById(R.id.textView1);

  final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
  Cursor c = getContentResolver().query(SMS_INBOX, null, null, null, null);
  int unreadMessagesCount = c.getCount();
  c.deactivate();

  view.setText(String.valueOf(unreadMessagesCount));
  • 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-06T21:53:16+00:00Added an answer on June 6, 2026 at 9:53 pm

    If you only want the last message sent by a specific number use this:

    final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
    Cursor cursor = getContentResolver().query(SMS_INBOX, null, "address = ?", 
            new String[] {"9999999999"}, "date desc limit 1");
    if(cursor.moveToFirst()) {
        // Do something 
        Log.v("Example", cursor.getString(cursor.getColumnIndex("body")));
    }
    cursor.close();
    

    The second answer to How many database columns associated with a SMS in android? is a great reference for different columns in an SMS.

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

Sidebar

Related Questions

This Query can search any string value (table name, table data etc) from all
I have this query where I can search the TABLE_GLOBAL_PRODUCTS $catglobal_sql = select p.*,
This is quite weird but my search function can search for any word except
Is there a way that I can search a variable starting from a given
Can anyone tell me ways to do this kind of search in a database?
I feel like this is something I can search for, but I don't know
How can search a commit using git web interface. For example, here is a
It seems System.DirectoryServices.AccountManagement provides query by example which can only search one type of
I have to build a software which can search and display PDF files from
I have a method where the user can search for a article number and

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.