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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:04:01+00:00 2026-05-19T22:04:01+00:00

Hello i am trying to create SMS aplication witch shows me SMS Inbox in

  • 0

Hello i am trying to create SMS aplication witch shows me SMS Inbox in ListView.But if i open this aplication there is no action.I can see only black screen with name of aplication 🙁 .Can somebody check my source code and tell me where is the problem? Thank you.

There is source code:

package sms.five;

import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Smsfive extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState, ListView messages) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ListView list = (ListView) findViewById(R.id.list);

        List<String> msgList = getSMS();

        for(int i = 0; i<msgList.size(); i++) {
            System.out.println(msgList.get(i));
       }
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.main, msgList); 
        list.setAdapter(adapter);
        list.setOnItemClickListener(new OnItemClickListener()
       {
        @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
         SmsManager m = SmsManager.getDefault();
         String destinationNumber=(String) ((TextView)view).getText();              
         m.sendTextMessage(destinationNumber, null, destinationNumber, null, null);

       }          
         });
       }

    public List<String> getSMS() {      
        List<String> list = new ArrayList<String>();
        Uri uri = Uri.parse("content://sms/inbox");
        Cursor c = null;
        try{
            c = getApplicationContext().getContentResolver().query(uri, null, null ,null,null); 
        }catch(Exception e){
            e.printStackTrace();
        }
        try{
            for (boolean hasData = c.moveToFirst(); hasData; hasData = c.moveToNext()) {
                final String address = c.getString(c.getColumnIndex("address"));
                final String body = c.getString(c.getColumnIndexOrThrow("body"));
                list.add("Number: " + address + " .Message: " + body);
            }
        }catch(Exception e){
            e.printStackTrace();
        }
     c.close(); 
     return list;
    }
}

XML File(main.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</ListView>
</LinearLayout>

AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="sms.five"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Smsfive"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>


<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
</manifest> 
  • 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-05-19T22:04:01+00:00Added an answer on May 19, 2026 at 10:04 pm

    I’m assuming your getSMS() is not returning anything. You can check this by adding some debugging code after this line:

    List<String> msgList = getSMS();
    

    Something like

    Log.d("yourTag","number of items: ".msgList->size());
    

    It seems that it doesn’t return anything. You might start by debugging that particular function: are there any exceptions caught? add some logging to see that. Maybe you didn’t add the correct line in your manifest

     <uses-permission android:name="android.permission.READ_SMS"/>
    

    Or something else goes wrong in that function. Did you write it yourself, or was it a copy?

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

Sidebar

Related Questions

Hello can anybody solve this please I'm creating the object in the action class
Hello there i'm trying to create a form with Zend_Form that will enable my
I am trying to create a Hello world application in Silverlight 3.0, but when
I'm trying to create a textmate snippet that will transform this: HELLO WORLD<br />
**Hello, I'm trying to create an archiver in java. This means that I am
I'm trying to create a very simple Hello, world program in RoR, but when
I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
To be specific, I was trying this code: package hello; public class Hello {
I am trying to create my hello world windows app in WPF. What should
I am trying to create a Hello World SWT application using Eclipse. I follow

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.