搜索记录android
我正在使用sqlite开发android应用程序。当我运行以下代码行时,我收到一个错误搜索记录android,android,sqlite,Android,Sqlite,我正在使用sqlite开发android应用程序。当我运行以下代码行时,我收到一个错误 if(student_name.length()>0) { db.open(); Cursor c= db.searchByName(student_name);//upto this all is fine c.moveToFirst(); //when i debug, i found exception is on this line.
if(student_name.length()>0)
{
db.open();
Cursor c= db.searchByName(student_name);//upto this all is fine
c.moveToFirst(); //when i debug, i found exception is on this line.
names=new String[c.getCount()];
for(int i=0;i<names.length;i++)
{
names[i]=c.getString(1);
c.moveToNext();
}
db.close();
}
if(student_name.length()>0)
{
db.open();
游标c=db.searchByName(学生名);//到目前为止一切都很好
c、 moveToFirst();//调试时,我发现异常在这一行。
名称=新字符串[c.getCount()];
对于(inti=0;i尝试使用while循环解析数据
while(c.moveToNext()){}
如果不使用c.moveToFirst()
方法!!请不要对错误消息保密。