-1

I m new to android and want a dynamic tablelayout in my app. The json below is posted and I want a table layout showing title as "Service" tag(washing) as first table row and below its details:"Cost" &"quantity". Then a sleek black line & then title 2 (service:ironing) and its details.I dont know how to iterate through json fields.Please help me on this.

[{"Label":"5kg","Service":"Washing","Service_type":"Normal Delivery","Cost":"100","Quantity":"till 5kg"},{"Label":"5kg - 7kg","Service":"Washing","Service_type":"Normal Delivery","Cost":"200","Quantity":"5kg - 7 kg"},{"Label":"Above 7kg","Service":"Washing","Service_type":"Normal Delivery","Cost":"300","Quantity":"Above 7kg"},{"Label":"5kg","Service":"ironing","Service_type":"Normal Delivery","Cost":"100","Quantity":"5kg"},{"Label":"5kg - 7kg","Service":"ironing","Service_type":"Normal Delivery","Cost":"200","Quantity":"5kg - 7kg"},{"Label":"Above 7kg","Service":"ironing","Service_type":"Normal Delivery","Cost":"300","Quantity":"Above 7kg"},{"Label":"5kg","Service":"woollen washing","Service_type":"Normal Delivery","Cost":"100","Quantity":"5kg"},{"Label":"5kg - 7kg","Service":"woollen washing","Service_type":"Normal Delivery","Cost":"200","Quantity":"5kg - 7kg"},{"Label":"Above 7kg","Service":"woollen washing","Service_type":"Normal Delivery","Cost":"300","Quantity":"Above 7kg"},{"Label":"5kg","Service":"washing and folding","Service_type":"Normal Delivery","Cost":"100","Quantity":"5kg"},{"Label":"5kg - 7kg","Service":"washing and folding","Service_type":"Normal Delivery","Cost":"200","Quantity":"5kg - 7kg"}]

1 Answers1

0

there is an java API for json

http://www.oracle.com/technetwork/articles/java/json-1973242.html [edit: not on android]

on android there is GSON https://github.com/google/gson

http://www.javacodegeeks.com/2011/01/android-json-parsing-gson-tutorial.html

or using the built-in functions of android: How to parse JSON in Android

dynamic table layouts are i.e. in this thread: Android : Dynamic TableLayout

Community
  • 1
  • 1
ralf htp
  • 9,149
  • 4
  • 22
  • 34
  • Could you please provide a code instead to count all these and create a tablelayout, its getting confusing for me as I dont know how to craete dynamic tablelayout+iterate through json accordingly. Although I am trying to solve this but not getting upto the level. – Prashant Singh Verma Oct 12 '15 at 14:28
  • Is there any short way, I need it badly in less time – Prashant Singh Verma Oct 12 '15 at 14:43