Query the API for items
Create a basic UI with 3 views (CiewControllers for iOS and activities for Android) and a tab bar.
Each view will represent a section of the app (Home, News, and Gallery).
To obtain the content that will be displayed in the views, call this function with the id of the block that you can see from the dashboard:
โ€‹
iOS
Android
1
MBClient.getSectionsWithBlockId(THE_BLOCK_ID, parameters: nil, success: { (sections, paginationInfos) in
2
โ€‹
3
}, failure: { (error) in
4
5
})
Copied!
1
MBurgerTasks.askForSections(context, HOME_BLOCK_ID, null, true, listener)
2
โ€‹
3
...
4
โ€‹
5
@Override
6
public void onSectionsApiResult(ArrayList <MBSection> sections, long block_id,
7
MBPaginationInfo paginationInfos) {
8
9
ArrayList <Home> homePages = new ArrayList <> ();
10
for (int i = 0; i < sections.size(); i++) {
11
Home home = mapHome(sections.get(i));
12
homePages.add(home);
13
}
14
showHome();
15
}
Copied!
Now you need to create Home objects from MBSection objects in order to create an array of Homepages we will use the mapping functions of the section object to do this.
โ€‹
Last modified 1yr ago
Copy link