Class Structure
Kii Balance is designed using the following class structure.
The classes with the stereotype <<Android>> belong to the Android SDK and that with <<Kii>> belongs to the Kii Cloud SDK. The classes whose background is pale blue are implemented in Kii Balance.

Each class corresponds to one of the screens of the user interface as shown in the figure below. The XML files in the figure represent the layout resources stored in the app/src/main/res/layout directory.

The classes are included in the packages below:
The
com.kii.sample.balancepackageThe
MobileAppclass and theMainActivityclass are in this package.The
MobileAppclass inherits theApplicationclass of Android, and is used to initialize the Kii Cloud SDK when the mobile app starts. For more information about the implementation, see the sections for AndroidManifest.xml and the Application class in the Hello Kii tutorial.The
MainActivityclass inherits theAppCompatActivityclass in the support library. This is the only activity in Kii Balance. Switching fragments opens the corresponding screen.The
com.kii.sample.balance.titlepackageThis package includes the classes for the title screen.
When the internal view in the
MainActivityclass has aTitleFragmentinstance, the title screen opens. Tapping the "LOGIN" button displaysLoginDialogFragmentand tapping the "REGISTER" button displaysRegistrationDialogFragmentas a dialog on the screen.After the input is completed, the login or user registration API of the Kii Cloud SDK is called according to the implementation of each dialog class. The data listing screen opens if the call is successful.
The
com.kii.sample.balance.listpackageThis package includes the classes for the data listing screen.
When the internal view in the
MainActivityclass has aBalanceListFragmentinstance, the data listing screen opens.As with the implementation of the
ListFragmentclass, eachKiiObjectis obtained via theKiiObjectAdapterclass.When the "+" button or an entry in the list is tapped,
ItemEditDialogFragmentis displayed for adding or editing an entry.The
com.kii.sample.balance.kiiobjectpackageThis package consists of the
Fieldinterface that defines constants in theKiiObjectin Kii Balance and theConstantsclass that defines AppID and so on.The
com.kii.utilpackageThis package contains utility classes that are shared across the program.
This package consists of the
ViewUtilclass for making screen transitions and displaying a toast message, and theProgressDialogFragmentclass for indicating the progress of a task.
Key points for implementation of mobile apps are explained later in this tutorial. For the other parts, analyze the source code by using this topic as a reference.
What's Next?
Let us quickly review techniques used in the sample code.