Note: Zoho Creator's Mobile SDK is currently a Beta feature. We do not recommend using it for apps in the production stage.
Java
Below are the code snippets that demonstrate how to use the different methods of Zoho Creator's SDK for Android:
To fetch the sections present in a Creator app
In the below snippet, Zylker_Orders is the target Creator application's link name:
- try {
- // your code goes here
- ZCApplication firstApp = appList.get(0);
- List<ZCSection> sections =
- ZOHOCreatorUtil.getApplicationDetails(firstApp);
- } catch (ZCException e) {
- e.printStackTrace();
- // Handle Error
- }
In the below snippet, Orders is the target form's link name:
- try {
- ... // your code goes here
- ZCSection firstSection = sections.get(0);
- ZCComponent firstComponent =
- firstSection.getComponents().get(0);
- if(firstComponent.getType().equals(ZCComponentType.FORM)){
- ZCForm form = FormUtil.getForm(firstComponent);
- }
- } catch (ZCException e) {
- e.printStackTrace();
- // Handle Error
- }
In the below snippet, All_Orders is the target report's report name:
- try {
- ... // your code goes here
- ZCSection firstSection = sections.get(0);
- ZCComponent firstComponent =
- firstSection.getComponents().get(0);
- if(firstComponent.getType().equals(ZCComponentType.REPORT)){
- ZCReport report = ReportUtil.getReport(firstComponent);
- }
- } catch (ZCException e) {
- e.printStackTrace();
- // Handle Error
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
Kotlin
To fetch the sections present in a Creator app
In the below snippet, Zylker_Orders is the target Creator application's link name:
- try {
- ... // your code goes here
- val firstApp: ZCApplication = appList.get(0)
- val sections: List = ZOHOCreatorUtil.getApplicationDetails(firstApp)
- } catch (e: ZCException) {
- e.printStackTrace()
- // Handle Error
- }
In the below snippet, Orders is the target form's link name:
- try {
- ... // your code goes here
- val firstSection: ZCSection = sections.get(0)
- val firstComponent = firstSection.components.get(0)
- if (firstComponent.type == ZCComponentType.FORM) {
- val form: ZCForm = FormUtil.getForm(firstComponent)
- }
- } catch (e: ZCException) {
- e.printStackTrace()
- // Handle Error
- }
In the below snippet, All_Orders is the target report's report name:
- try {
- ... // your code goes here
- val firstSection: ZCSection = sections.get(0)
- val firstComponent = firstSection.components[0]
- if (firstComponent.type == ZCComponentType.REPORT) {
- val report = ReportUtil.getReport(firstComponent, 50)
- }
- } catch (e: ZCException) {
- e.printStackTrace()
- // Handle Error
- } catch (e: CloneNotSupportedException) {
- e.printStackTrace()
- }