Question

I have project in which i want to create tab view in which all tab generated from json depend upon json. and content of tab view is list view and again listview data come from json.

here i am providing my json file

“checks”{“check”:{
                  “ref”:”1”,
                  “area”:”In Cab”,
                  “title”:”Condition of windscreen”,
                   “description”:”Check there are no cracks, that the windscreen is                          clean and not greasy.”,
                  “controlType”:”Check”,
                  “checkResult”:””,
                  “checkValue”:””
                },
        “check”:{
                 “ref”:”2”,
                 “area”:”External”,
                 “title”:”Windscreen wipers”,
                 “description”:”Check the wiper surface is smooth and not cut and the   wiper touches the screen on its full length.”,
                 “controlType”:”Check”,
                 “checkResult”:””,
                 “checkValue”:”” 
                },
        “check”:{
                 “ref”:”3”,
                 “area”:”Input”,
                 “title”:”Registration”,
                 “description”:”Enter the registration number for the vehicle.”,
                 “controlType”:”TEXT”,
                 “checkResult”:””,
                 “checkValue”:””
                },
       “check”:{
                “ref”:”4”,
                “area”:”Input”,
                “title”:”Mileage”,
                “description”:”Enter the mileage for the vehicle.”,
                “controlType”:”NUMBER”,
                “checkResult”:””,
                “checkValue”:””
               },
      “check”:{
               “ref”:”5”,
               “area”:”Input”,
               “title”:”Tacho Expiry Date”,
               “description”:”enter the tacho expiry date.”,
               “controlType”:”DATE”,
               “checkResult”:””,
               “checkValue”:””
              },
      “check”:{
               “ref”:”6”,
               “area”:”Input”,
               “title”:”Warning light colour”,
               “description”:”Enter the warning light colour.”,
               “controlType”:”SELECT”,
               “selectValues”:”’Red, ‘Amber’,’’Green”,
               “checkResult”:””,
                “checkValue”:””
               }
}

here tab is created based on area tag in json

and content of tab is based on area that is title, description.
so i am confused how to create tabs and how to add content in different tabs

Thank in advance

No correct solution

OTHER TIPS

try this :

btnAddTab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            TabHost.TabSpec spec = tabHost.newTabSpec("Tab"+i);
            spec.setContent(new TabHost.TabContentFactory() {
                @Override
                public View createTabContent(String tag) {
                    return new AnalogClock(MainActivity.this);
                }
            });
            spec.setIndicator("Clock");
            tabHost.addTab(spec);
        }
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top