The app will feature a tab based design; one of the contact editing and the other to view the contacts. The project will be built using Adobe Flash Builder 4.6 and corresponding SDK. Once the app is built and tested, I will provide the steps to do to package the app for deployment to the Google Play web Android web store. Select “New Flex mobile Project” from the File menu. Under “Project Location”, provide a Project name in the project creation utility. See corresponding screenshot in figure 1 (opposite). Select the Tabbed application project template. This will allow us to create a tab based Android app. Take a look at figure 2 in the adjacent screenshot for a visual guide. Under Server Settings and Build Paths accept the defaults and click “Finish” to create the initial project. Once the project is created and the project‘s main application file, AndroidSQLite.mxml, view code listing 1 below, is opened in the Visual Designer, select the target device from the drop down list. You work area of your screen should automatically adjust to the screen resolution of the selected device.
You can also use this list to test your app on several different devices. The Flash Builder 4.6 offers all the current device version on the market at the present time. You can add new device configurations as new models are introduced to the market. To add a new device , locate the Device configuration section in Preferences. The first part of this project involves developing the SQLite database interface, the Model and the Controller in the MVC design pattern. The code will include functions to setup and initialize the database, to insert new records and to select existing records. Once this code is complete, we will connect the ActionScript code to the mxml views in order to make the application complete. To start create a new folder inside of the Views folder. You right click on the View folder in the Project Explorer and select the new folder option in the context menu. For this example I named the folder "scripts".
Actionscript File to create a new script file in the folder. You can name it whatever you like. The first order of business is to define the import statements that we will use in our code. These classes include the SQLConnection which handles connections with the database. The SQLStatement as you may have guessed represents the query statements. The three following classes are to handle SQL success and failure events and the Events class handles any interaction with the components. The File class is used to interface with the database file. The ArrayCollection is a class to handle multi-dimensional arrays. Next define the global variables for the connection, statement and ArrayCollection. ] directive which will maintain state between calls to the variables. This function is called from the applicationComplete event of the TabbedViewNavigatorApplication main application element. The function creates the database using the File class and we use the OpenSync to open the database.