背景 - 我正在尝试检索按州过滤的拍卖列表。我正在尝试检索拍卖日期和拍卖名称。
我从列表视图中获取状态名称 - 状态值被正确传递(我已经注释掉了构建状态列表的函数名称并使用 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 Pointer Exception 错误 - 应用程序似乎永远不会获取代码以计算记录数。
任何建议表示赞赏。谢谢