I am attempting to query parse for every entry in a Parse Class, I was able to do it with swift but am having trouble doing this for android. The code I used for swift is :
var query = PFQuery(className: "Inventory") query.findObjectsInBackgroundWithBlock { (products, error:NSError?) -> Void in if(error == nil ){ //success for product in products! { self.items.append(product["productName"] as! String) self.descriptions.append(product["description"] as! Int) self.prices.append(product["price"] as! Int) } self.productsTableView.reloadData() }else { print(error) } } //for each unique tableView cell: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let singleCell: productTableViewCell = tableView.dequeueReusableCellWithIdentifier("productCell") as! productTableViewCell singleCell.productName.text = items[indexPath.row] singleCell.detail.text = "\(descriptions[indexPath.row])" singleCell.cost.text = "\(prices[indexPath.row])" return singleCell }
in this code I have a few arrays in which after querying parse I add the details of every entry to the arrays and then for every product name theres a new tableview cell, anyone know how I would manage the same effect for an android table row?
I am using android studio
No comments:
Post a Comment