Some screens allow you doing your own page layout and customize the items the way you want.
Make me Droid not only lets you display your own content using these items (texts, buttons, pictures, containers...) but also allows you making it become interactive (exchange with application users, send and receive).
Forms are at the heart of this interactivity, letting you send content, list it, and search it.
Here is a real use case to show you how to use these forms: a simple system for classified ads in your Android application.
To make a very simple version of a classifieds application, 3 screens are necessary:
To add a classified: a custom layout screen.
To list existing classifieds: a dynamic list screen.
To view classifieds details: a custom layout screen.
New classifieds will be sent to Make me Droid online storage using forms, and retrieved from mobile devices on demand.
Forms and actions
A form is simply a name assigned to screen items such as horizontal/vertical containers or any other custom layout item able to contain sub-items. Every item contained in a form belongs to this form.
Some of the items used in your layout, such as texts, pictures and buttons, can be associated to actions. Actions are of several kinds; the one we want to focus for our example is Send a form to Make me Droid online storage.
Here is how to build a screen that will let users sending a new classified.
Create a custom layout screen and set it as initial screen for your application.
Click in the middle of this new screen to view its properties.
From the properties panel, use the button to add a new horizontal container item.
Process the same way to add 2 more items to the horizontal container:
One text input item.
Select the horizontal container and set MyForm as a form name. This name will then let you store, group and retrieve your content.
Select the text input item and set its identifier to MyMessage. This identifier will be used to access data during the next steps.
Then select the button and define its "click" action: choose Send a form, select MyForm, then validate clicking on Use this set. Go back to the screen editor through Set action.
The screen to send new classifieds is now ready. Here is how to list classifieds that users will have sent:
Dynamic lists and data sources
During the previous step, we chose to send forms to Make me Droid online storage. This means that information sent by users are stored on internet. This is also from there that we will retrieve all the forms that have been sent, to display them in a list.
This is called a data source, because we will use it to dynamically fill some parts of our screens, instead of manually adding our own information.
Here are the steps to display the existing forms to users:
Create a dynamic list screen. Default screen content is the layout model that will be used for each item of the list. The dynamic list will add this model as many times as the number of forms sent by users, inserting information related to each of them.
Select the screen you have just added from the screen list. Properties are shown. Edit the data source for this screen.
Set Form from online storage as a data source type then select MyForm. We just made a link between the sent forms and the list that will display them, thanks to the form name that we defined during the previous step. Press Set data source to go back to the editor.
Keywords such as $[an_identifier] are used to tell the application that you wish to replace it with real content existing in the form data and having an identifier that matches this keyword. Edit one of the existing texts in the model and set its value to $[MyMessage].
Now link this screen to one of the page footer shortcuts in order to access it later on, as the current application default screen is the one we will use to send forms.
We just defined 2 important information: the dynamic list retrieves its content from the list of forms MyForm obtained on the online form storage and then, when the list will show, every item of this list will convert the $[MyMessage] keywords into real data that a user previously filled in just before sending its form.
Your application can already be tried. Once installed on a device, first send one or multiple classifieds, then go to your classifieds list screen to check the result.
Data sources, again
If you have tried your application before reaching this step, you may have noticed that when you click on an item in the list of classifieds, nothing happens. Now, we would like to show classified detailed information when someone clicks on one of the items of the list.
The data source we used in the previous chapter was a collection of sent forms, and each item of that collection was a collection of information (input text, pictures...).
When a dynamic list item is clicked, it provides its own information (a collection of information) to the next screen. This means that if your classifieds list contains 2 entries, one being "I want to sell my car" and the other one being "Looking for a Samsung phone", if you click on "I want to sell my car", the next screen will be able to access the field $[MyMessage] which will actually display I want to sell my car on screen.
Here is how to improve your application to show classifieds details when users click on a list item:
Create a new custom layout screen.
Add a vertical container inside, in which you can add 2 texts: the first one is your page title, and the second one will display real classified content.
Edit the second text, setting its value to $[MyMessage].
Select your dynamic list screen again from the screen list, then select the Dynamic list item item on the model.
Set the "click" action for this item, making it show a screen. The screen to display is the one we just created.
Your classifieds system is now ready to run! Do not hesitate to contact us if you meet some problems trying to setup this scenario.
Focus on the meaning of form, data sources, identifiers and $[...] keywords to access information, and you will be able to create a high quality application in a few minutes.
Some special keywords are available from almost everywhere in your application: