In the query that created the cursor 'c', you specified a list of columns that needs to be returned for each row. The columns in this list could have been put there in any order (much like columns mentioned in SQL after 'SELECT' and before 'FROM'). This specified list of columns could even have been 'null' when 'query' was called, meaning that all columns are returned.
If you just have the cursor 'c', you can't know what the order of the columns is. That is where 'index = c.getColumnIndex(String columnName)' comes into play. Then using the returned index, you call 'c.getString(index)', returning the string-value of column 'index' of the current row. The putExtra call can take any string as its first parameter. It is just a name. The call to putExtra has nothing to do with database colummns and such. In this particular example it makes sense: Put into the 'extra' a name&value-pair for name=KEY_BODY and its value=value- from-the-database. The 'putExtra' can take a variation of types as its second argument. Check out the JavaDoc http://developer.android.com/intl/fr/reference/android/content/Intent.html . On Feb 25, 10:58 pm, Hunk of Hulk <[email protected]> wrote: > i.putExtra(NotesDbAdapter.KEY_BODY, c.getString( > c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY))); > > Hi, > > I don't understand this code line from the notepad tutorial. > What is the second parameter c.getString()..... > doing here? > > Is it getting the column index of the string "body"? In the database > table, it's _id, title, body, so is this value 2? > And then it's making the 2 into a String when the putExtra in the java > doc states that it expects a long value? > > Thanks -- 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

