游标没有返回任何值,它显示错误?

时间:2015-09-03 11:54:34

标签: android-sqlite

我从TourGuideController调用readPlaceName,并在方法readPlaceName(Placename)中传递字符串,光标显示空指针exeception,没有显示任何值,是否可以为此错误提供解决方案?

TourGuideController.java

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
ubuntu    2035 67.6 45.4 3630724 1838232 ?     Sl   10:03 133:59 sidekiq 3.5.0 my_app [0 of 25 busy]     

MainActivity.java

public Cursor readPlaceName(String place_name){


    String sql = "SELECT  * FROM " + TourGuideDatabasehandler.VISTING_INBETWEEN_PLACES +
    " WHERE "+ TourGuideDatabasehandler.PLACE_NAME + " = '" + place_name+"'";
    Log.e("","Sql "+sql); 
     Cursor v = database.rawQuery(sql,null);
     Log.e("v","Cursor v : "+v.toString());

     return v;


}

0 个答案:

没有答案