Skip to content

Commit

Permalink
update sample products
Browse files Browse the repository at this point in the history
  • Loading branch information
amirdew committed May 22, 2017
1 parent 4bdf48a commit bfce167
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/src/main/assets/products.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
{ "products":[
{
"id": 2,
"name": "An ice sculpture",
Expand Down Expand Up @@ -28,4 +28,5 @@
"longitude": -32.7
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {


//parse json from asset file:
JSON products = new JSON(readFileFromAsset("products.json"));
JSON products = new JSON(readFileFromAsset("products.json")).key("products");
for (int i = 0; i < products.count(); i++) {
JSON productInfo = products.index(i);
resultText += String.format("\n\n product[%d]: id:%d, name:'%s', price:%.2f, length:%.2f",
Expand Down

0 comments on commit bfce167

Please sign in to comment.