Hi,

I am writting an Application that gets messages SMS/Email etc, I have
a listActivity and want to only display the contact name if it is
known in the address book. I keep getting an exception :

04-17 23:47:49.090: ERROR/AndroidRuntime(949):
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.zoomsms.android.activity/
com.zoomsms.android.activity.SMSActivity}:
java.lang.IllegalArgumentException: column 'name' does not exist
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2141)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2157)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.os.Handler.dispatchMessage(Handler.java:88)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.os.Looper.loop(Looper.java:123)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread.main(ActivityThread.java:3739)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
java.lang.reflect.Method.invokeNative(Native Method)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
java.lang.reflect.Method.invoke(Method.java:515)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
dalvik.system.NativeStart.main(Native Method)
04-17 23:47:49.090: ERROR/AndroidRuntime(949): Caused by:
java.lang.IllegalArgumentException: column 'name' does not exist
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.database.AbstractCursor.getColumnIndexOrThrow
(AbstractCursor.java:310)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.database.CursorWrapper.getColumnIndexOrThrow
(CursorWrapper.java:99)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.widget.SimpleCursorAdapter.findColumns
(SimpleCursorAdapter.java:301)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.widget.SimpleCursorAdapter.<init>(SimpleCursorAdapter.java:87)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
com.zoomsms.android.activity.SMSActivity.onCreate(SMSActivity.java:78)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
04-17 23:47:49.090: ERROR/AndroidRuntime(949):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2104)


When running the following code :


        super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                String[] columns = new String[] { SMSConstants.ADDRESS,
                                SMSConstants.BODY, People.NAME};
                int[] names = new int[] { R.id.subject, R.id.message ,
R.id.row_entry};
                Cursor c = getSMSCursor();
                myAdapter = new SimpleCursorAdapter(this, R.layout.table,
                                c, columns, names);
                startManagingCursor(c);
                setListAdapter(myAdapter);



I assume, this is because the Phone.NAME does not exist for all the
entries. Is there anyway I can check for a NULL contact and display
only those that return a value ?

-thanks in advance

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

Reply via email to