Monday, November 19, 2012

SQLite Database

Since the application will eventually be used to log information, it would need a way to store and save information when the user closes the application.  And when the user starts the application again, the app needs to be able to retrieve these information.

I finally got some sort of database running for the application using SQLite.  The way the information is being accessed is through ContentProvider.  "Content providers are the standard interface that connects data in one process with code running in another process."


Below are screenshots of the Android emulator showing the interface while using the database in the background.  One important thing to note is that the items/entries gets saved and retrieved when the applications is shut down and booted back on.





Database is empty

After adding 3 entries

After removing the 2nd entry


The coding for the database has become significantly complex and is now using multiple xml files and java classes. 

-----------------------
“A trade by which one gains and the other loses is a fraud. 
You don't do it in business, Hank.  Don't do it in your own life.”

Monday, November 5, 2012

Multiple Activities

"The basic unit of an Android application is an Activity. An Activity displays the user interface of your application, which may contain widgets like buttons, labels, text boxes, etc."  [Source]


I guess an Android activity is similar to a webpage.  An Android activity contains the UI which includes views (e.g., widgets such as buttons), which is similar to a webpage containing the web interface.  Of course, you can also have multiple views just like there are multiple webpages in a given site.

Below are the screenshots of an app that I created that uses 2 activities.  To be able to switch between the 2 activities, one must click the button.  Clicking the button displays the other activity.


Activity One



Activity Two


Each of the Activity has to use its own set of XML code and Java class.   Below are snapshots of the XML files for the two activities.


XML file for Activity One


XML file for Activity Two

-----------------------
“Every living thing must grow. It can't stand still. It must grow or perish.”