Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void populateProductList() {
- if (!products.isEmpty()){
- products.clear();
- }
- String query = "SELECT P_CODE,BRAND_NAME,P_GROUP,PACK_S FROM PRODUCT_INFO where 1=1 ";
- if(_searchString.length() > 0 )
- query += " AND BRAND_NAME like '"+ _searchString + "%' ";
- if(_pGroupName.length() > 0 && !_pGroupName.equalsIgnoreCase("All"))
- query += " AND P_GROUP = '" + _pGroupName + "' ";
- query += " ORDER BY BRAND_NAME ";
- cur = executeQuery(query);
- _totalProducts = 0;
- if(cur.moveToNext()) {
- _totalProducts = cur.getCount();
- }
- tvTotalProduct.setText("Product("+_totalProducts+")");
- if(end >= _totalProducts ){
- end = _totalProducts;
- buttonViewMore.setVisibility(View.GONE);
- }else{
- buttonViewMore.setVisibility(View.VISIBLE);
- }
- query += " LIMIT 0, " + end;
- cur = executeQuery(query);
- while (cur.moveToNext()) {
- String p_code = cur.getString(0);
- String brand_name = cur.getString(1) + "-" + p_code + "-"
- + cur.getString(2) + "-" + cur.getString(3);
- String unitPriceQuery = "select T_P,S_P from PRODUCT_INFO_PRICE where P_CODE='"
- + p_code + "'";
- Cursor c = productDb.rawQuery(unitPriceQuery, null);
- while (c.moveToNext()) {
- productData = new ProductData(p_code, brand_name,
- c.getString(0), c.getString(1));
- products.add(productData);
- }
- if(!c.isClosed()){
- c.close();
- }
- }
- initProductDataAdapter();
- productDataAdapter.notifyDataSetChanged();
- lvResults.setAdapter(productDataAdapter);
- if(!cur.isClosed()){
- cur.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment