Hi to all,

Im trying to read the sms inbox with getContentResolver() , and the
create a list of all messages with SimpleCursorAdapter. I can read
fine all the fields with the cursor methods, but when I try create a
list of sms bodies with SimpleCursorAdapter, the list appears(with the
correct number of rows), but it´s void.

Any help would be apreciated.
Thanks in advance.



.java file:
------------------------------------------------------------------------
Public class smsInbox extends ListActivity {

        private ListAdapter mAdapter;

        /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        String SORT_ORDER = "date DESC";
        String SMS_READ_COLUMN = "read";
        int count = 0;

        Cursor cursor = getContentResolver().query(Uri.parse
("content://sms/inbox"),
                        new String[] { "_id", "thread_id", "address", "person",
"date", "body" },
                null,null,SORT_ORDER);

        startManagingCursor(cursor);

        String[] columns = new String[]{"body"};
        int[] names = new int[] {R.id.row_entry};

        mAdapter = new SimpleCursorAdapter(this, R.layout.main,
cursor, columns, names);
        setListAdapter(mAdapter);

    }
 }
------------------------------------------------------


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

Miguel.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to