背景 - 我试图检索由州过滤的拍卖列表。我试图检索拍卖日期和拍卖名称。
我从列表视图中获取状态名称 - 正确传递状态值(我已经注释掉构建状态列表并使用Toast验证好值的函数的名称)
我的问题发生在fillAuctionsList(String editAuctionState);
public void fillAuctionsList(String editAuctionState){
//sql Query - editAuctionState is the State selected
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
//set the table to the Auction
queryBuilder.setTables(Auctions.AUCTIONS_TABLE_NAME);
// build the return columns for my listview
String asColumnsToReturn[]= {
Auctions.AUCTIONS_TABLE_NAME + "." + Auctions.AUCTIONS_AUCTION_NAME,
Auctions.AUCTIONS_TABLE_NAME + "." + Auctions.AUCTIONS_DATE,
Auctions.AUCTIONS_TABLE_NAME + "." + Auctions.AUCTIONS_STATE,
Auctions.AUCTIONS_TABLE_NAME + "." + Auctions._ID};
//end of build columns to return
//build the where statement based on the Auction State
String howToFilter[]={editAuctionState};
//build the cursor
mCursor = queryBuilder.query(mDB, asColumnsToReturn, Auctions.AUCTIONS_STATE + "=?", howToFilter,null, null, null);
//manage the cursor
startManagingCursor(mCursor);
int HowManyRecords = mCursor.getCount();
if(HowManyRecords==0){
Toast.makeText(getApplicationContext(),"No Records Found",Toast.LENGTH_LONG).show();
finish();
}
此后更多光标代码。
我在querybuilder语句中得到Null指针异常错误 - 应用程序似乎永远不会到达代码来计算记录数。
任何建议表示赞赏。 感谢
答案 0 :(得分:0)
问题解决了......
我有一个'呃'的时刻,并没有打算真正打开数据库。