Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
搜索记录android_Android_Sqlite - Fatal编程技术网

搜索记录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.

我正在使用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.

        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()
方法!!

请不要对错误消息保密。