I tried the case for id and that didn't work. Thanks for trying!! if
you have any other idea please let me know. This is the 4th day on
this problem.
Jeff
11-19 12:28:05.808: ERROR/AndroidRuntime(166):
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.csi.android.mPHR/com.csi.android.mPHR.MPhrList}:
java.lang.IllegalArgumentException: column '_id' does not exist
the DB is working it is the SimpleCursorAdapter that is tossing the
exception
<------------>
private static final String[] PROJECTION = new String[] {
//Meds._ID,
"_id",
//Meds.sSOURCE,
Meds.sPRODUCT,
//Meds.sDIRECTIONS,
//Meds.sFULLFILLHISTORY,
};
/** The index of the title column */
private static final int PRODUCT_IDX = 1;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.e(TAG, "OnCreate");
setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
Intent intent = getIntent();
if (intent.getData() == null) {
intent.setData(Meds.CONTENT_URI);
}
// Inform the list we provide context menus for items
getListView().setOnCreateContextMenuListener(this);
//setContentView(R.layout.medlist);
// Perform a managed query. The Activity will handle closing
and re-querying the cursor
// when needed.
Uri uri = getIntent().getData();
Cursor cursor = managedQuery(uri, PROJECTION, null, null,
Meds.DEFAULT_SORT_ORDER);
//Cursor cursor = managedQuery(Meds.CONTENT_URI, PROJECTION,
null, null, null);
Log.e(TAG, "OnCreate cursor.getCount = " + cursor.getCount());
Log.e(TAG, "OnCreate cursor.getColumnName0 = " +
cursor.getColumnName(0)); ******************************THIS log
RETURNS "_ID"
/* Used to map meds entries from the database to views
*/
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.mphrlist_item,
cursor,
new
String[] { MPhrDef.Meds.sPRODUCT}, //from
new int
[] { android.R.id.text1 }); //to
//Log.e(TAG, "!!OnCreate cursor = " +adapter.convertToString
(cursor));
On Nov 19, 10:51 am, Romain Guy <[EMAIL PROTECTED]> wrote:
> I'm afraid the column should be named "_id" and not "_ID". sqlite3
> doesn't care but it looks like our code that throws the
> illegalargumentexception does a case-sensitive comparison.
>
>
>
> On Wed, Nov 19, 2008 at 10:43 AM, Mark Murphy <[EMAIL PROTECTED]> wrote:
>
> > Jeff wrote:
> >> Hello, I am using a simple list and I am getting this exception. I
> >> get the error with the _ID in or out of the projection. when calling
> >> SimpleCursorAdaptor. The DB insert/guery is working.
> >> Anyone seen this problem?
>
> > I just *have* to stop answering emails when I have a cold...
>
> > OK, so you have an _ID column.
>
> > Can you post the Java exception traceback?
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com
>
> > Android Training on the Ranch! -- Mar 16-20, 2009
> >http://www.bignerdranch.com/schedule.shtml
>
> --
> Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---