SMS INBOX - LISTVIEW
<p>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.</p>

<p>There is source code:</p>

<pre><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&lt;String&gt; msgList = getSMS();

        for(int i = 0; i&lt;msgList.size(); i++) {
            System.out.println(msgList.get(i));
       }
        ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,R.layout.main, msgList); 
        list.setAdapter(adapter);
        list.setOnItemClickListener(new OnItemClickListener()
       {
        @Override
    public void onItemClick(AdapterView&lt;?&gt; 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&lt;String&gt; getSMS() {      
        List&lt;String&gt; list = new ArrayList&lt;String&gt;();
        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;
    }
}
</code></pre>

<p>XML File(main.xml):</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;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"
&gt;
&lt;ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
&gt;
&lt;/ListView&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>AndroidManifest.xml file:</p>

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

    &lt;/application&gt;


&lt;uses-permission android:name="android.permission.READ_SMS"&gt;&lt;/uses-permission&gt;
&lt;/manifest&gt; 
</code></pre>
