[android-developers] exception in getting data from cursor(database)
hello,
i am retrieving Cursor from database but when i am trying to get data
from cursor using colIndex. i am getting exception. can some one tell
me what is wrong in it. the following is code i am using . it is
giving exception at the sentence data[i]=result.getString(colIndex);
/*code*/
db=new DBAdapter(this);
db.open();
Cursor result=db.getAllNames();
Log.e("column:",":"+ result.getColumnCount());
String data[]=new String[result.getCount()];
for(int i=0;i<result.getCount();i++)
{
Log.e("column:",":"+ result.getColumnCount());
if(data[i]==null)
Log.e("null", "null");
data[i]=new String();
int colIndex=result.getColumnIndexOrThrow("name");
Log.e("colIndex", ":"+colIndex);
data[i]=result.getString(colIndex);
//data[i]=temp;
// Log.e("temp:", temp);
result.moveToNext();
hope to hear soon.
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home