本帖最后由 linglinggg 于 2013-12-12 16:51:44 编辑

解决方案 »

  1.   

    select count(*) from tb_pwd 这个肯定不会空的
      

  2.   

    if(cursor.moveToFirst()){         //判断是否有值
    count = cursor.getCount();//返回总记录数
                            Log.i(TAG,"coming");
    }
    改为if(!cursor.isAfterLast()){         //判断是否有值
    count = cursor.getCount();//返回总记录数
                            Log.i(TAG,"coming");
    }
      

  3.   

    你先確定一下你的錯誤在哪裏發生?你貼出來的函數如果數據庫表名沒有錯的話,邏輯上是沒有錯誤的,也可以簡單優化一下,如下long count = 0;
    ...
    if(cursor.moveToFirst()){         
        count = cursor.getCount();
    }
    cursor.close();
    return count > 0;