Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "sett": " ",
- "glHdr": {
- "sm": [ ],
- "scleHPad": false,
- "st": "sbsm"
- },
- "colrBG": [
- 23,
- 105,
- 184,
- 100
- ],
- "colrTB": [
- 0,
- 0,
- 0,
- 0
- ],
- "colrTR": [
- 255,
- 255,
- 255,
- 100
- ],
- "glFtr": {
- "icoSz": "icoSzN",
- "sm": [ ],
- "scleHPad": false,
- "gvNR": 3,
- "gvHIT": false,
- "gvNC": 3,
- "st": "igsm"
- },
- "statBr": true
- },
- {
- "sm": [
- {
- "tbico": "b43-jeep.png",
- "t": "Welcome!",
- "w": "http://google.com/start",
- "st": "w",
- "wTBL": "wTBLN"
- },
- {
- "t": "Content screen title",
- "f": "Eltec%20Spec%20sheet%20Gim%20RD30W.pdf",
- "st": "f"
- },
- {
- "tbico": "109-chicken.png",
- "t": "Sub menu",
- "sm": [
- {
- "t": "Screen 1",
- "st": "f"
- },
- {
- "t": "Screen 2",
- "w": "Http://google.com",
- "st": "w",
- "wTBL": "wTBLT"
- }
- ],
- "st": "sm"
- },
- {
- "st": "f"
- }
- ],
- "st": "tbm"
- }
- ]
- //USING GSON In Parse.java
- public class Parse{
- public class Setting {
- String sett;
- int[] clorBG;
- int[] colrTR;
- int[] colrTRT;
- int fntIcoGrd;
- boolean statBr;
- //List<Share> shrMnuPrest; //Place name that matches to json from json-file element
- List<SM>sm;
- List<Share>shrMnuPrest;
- /*
- public boolean getStatbar(){
- return statBr;
- }
- public boolean setStatbar(){
- return this.statBr;
- }
- */
- }
- public class Share {
- String shrFBLnk;
- String shrTwtBdy;
- String shrTxtMsgBdy;
- String shrFBBdy;
- String sndEmlBtn;
- }
- public class Screen {
- String tbico;
- String t;
- String st;
- List<SM>sm;
- //List<SM2>sm2; should auto load from <SM> List
- }
- public class SM { //for Table View
- String bgFile;
- String icoSz;
- String t;
- boolean gvHIT;
- int gvNR;
- int gvNC;
- String st;
- List<SM2>sm2;
- List<Share> share;
- }
- static class SM2{ //Sub-menu screen type
- String st;
- String t;
- String f;
- String cusico;
- String bgFile;
- String icoSz;
- String fb;
- String wTBL;
- String w;
- }
- public static void main (String[] args) throws Exception{
- Log.i("RUNNING","Running Main call");
- String jsonLink = readUrl("http://10.0.2.2/"+"json/config.json");
- JsonElement json = new JsonParser().parse(jsonLink);
- JsonArray array = json.getAsJsonArray();
- Iterator iterator = array.iterator();
- while (iterator.hasNext()){
- JsonElement json2 = (JsonElement) iterator.next();
- Gson gson = new Gson();
- Setting sett = gson.fromJson(json2, Setting.class);
- //prints entire class
- System.out.println(sett.toString());
- //print WHAT you want!!
- System.out.println(sett.statBr);
- System.out.println(sett.clorBG);
- //System.out.println(sett.colrTRT);
- System.out.println(sett.colrTRT);
- }
- //Gson gson = new Gson();
- //Setting sett = gson.fromJson(json, Setting.class);
- //System.out.println(sett.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement