Application Development in Android

Android Tutorial Videos  Android Sqlite Video

This tutorial is on Android based programming. We will be developing android based applications. Gradually we will also take you through some advance concepts related to Android Application Development.

We will take the Shopping Cart Application as a project and demonstrate the development of this application in a step by step process. We will develop this Shopping Cart Application and test in emulator. The final version will be deployed in android based mobile.

We have made it easy to learn this using videos which include steps starting from installation, designing, development, queries and error resolution and finally deployment to mobile. Later on we will discuss on how to integrate the android version with JSF (Java Server faces) based Shopping Cart Application through the upcoming tutorials and also gain expertise in Android and JSF(Java Server faces) versions as well as how to integrate both the versions later through the tutorials.

How to start learning Android based programming?


There are many tutorials which will teach you some basic concepts of android programming. But when it comes to making a program yourself you may get stuck at a number of places and need help from different sources. The issue you might face could be from where to start and develop a complete application. 

Let us say that you want to develop an Application in Android. It may be a simple data entry application in Android say a feedback form. This Application sends an Enquiry and gets a Feedback. Now, from where to start?. Once you develop a two page form. Most of the queries will be answered. Android based programming concept will be answered and you will gain confidence in coding and will be ready for a complete solution based application in android like the Shopping Cart Application. This will include many good features of Android.


How to gain confidence in Android Based Programming?

You may gain some concepts while going through various tutorials on net. Once you develop a complete Application from start to completion, you will gain confidence and will be ready for development of a large integrated solution. This may be from Android Application to server Integrated Solution.


Why Shopping Cart Application for development and learning?




This Android based application is a client Application on Mobile. In online marketing, a shopping cart is a piece of e-commerce software on a web server that allows visitors to an Internet site. In short one may review items Catalogue for Items Description and price. Select an Item. Update a cart basket. Define Payment Model and Track the shipment. 

But from where the Items and supplier are appearing in Items catalogue?. For this we need to develop a Backend application to update Items, description, supplier and prices. We will be developing JSF (Java Server faces) and MySql based Application as backend Application in another tutorial and integrate both. 

This approach is from mobile to server connectivity on net. Mobile data and server data are entirely different. Then how to integrate both of them? All such will be answered while developing an actual code.


Before we start we may have some queries.

We will look for answer to these queries.

1. What tool we require? Is it an Eclipse, Netbeans or Android Studio?

2. What Applications we may require and setup? Is it a Xampp server or any other?

3. What Android Libraries are required to start program development? How to set up android in Eclipse etc?

4. What database we may require? Is It MySql server or other.

5. How to communicate with MySql and setup database? How the android communicate with MySql database?

6. Is the Android, PHP, Xampp and MySQL combination works OK?

Once all the above queries are answered. We my start with the development for Android based programming. But from where to start?

First we need to identify the features or pages to be developed in Android. We also need to Identify which API level we need to work with?

All the required tools to develop Android applications are freely available and can be downloaded from the Web.

Following is the list of software's you will need before you start your Android application programming.



  • Java JDK5 or later version.
  • Android SDK.
  • Java Runtime Environment (JRE) 6.
  • Eclipse, Net beans or Android Studio.
  • Android Development Tools (ADT) Eclipse Plug-in (optional).
  • Xampp, PHP

What process we will be following for development of Shopping Cart Application?


We will develop a complete Mobile Application on Shopping Cart. We will mention all the problems faced and solution adopted. Create PHP script to select and insert data to MySql.Database and table script created and implemented. We will do the amendments in database and look for proper resolution for Implementation. While doing the development we may have some queries and look for answer to these queries and implement the same.


Audience

This tutorial has been prepared for the beginners as well as for advanced learners who want to deal with Android based programming. This tutorial is also very useful for those who want to learn android based programming and gradually integrate with JSF. After going through tutorial on blogger and YouTube videos you will find yourself at a moderate level of expertise in knowledge of computer basics from where you can take yourself to next levels. This gives a complete solution and development of features of a Shopping Cart Application.


Prerequisites

Android programming is based on Java programming language so if you have basic understanding on Java programming then it will be a fun to learn Android Application Development.

Main Objective

The main Objective from this tutorial is to expertise in Android Programming and Integration with JSF (Java Server faces) Application.Same application is also developed in web based version in JSF (Java Server faces). Gradually we will integrate both the version. Data will be added through JSF application and same will be reflected in Android and vice versa. 

Gradually we will develop a complete Mobile Application on Shopping Cart. We will mention all the problems faced and solution adopted. Database and table script created and implemented. We will do the amendments in database and look for proper resolution for Implementation. While doing the development we may have some queries and look for answer to these queries and implement the same.

 
Shopping Cart Application
( Overview for Android Based Application )

Now we will give an overview of a Shopping Cart Application for the series of pages to be developed in Android. We give some details as what all each page contains and what all Android features are used in each page.

PHP scripts are written to extract and insert data and the same are used in Android application. This Website contains Menu tabs as Brief, Database creation, Debugging,Errors and resolutions, Code and Tutorial on Videos for your reviews and start with development.

Sl No
Description of Pages
Android Pages
1.
Alert Dialog

This  First Screen  displayed asking the user to login.
A alert dialog is Displayed if user is not logged in and asking to user to login. It will check for user name is specified at application level or not. user name is defined once the user has logged in.

Alert dialogs are with one,two or three buttons as OK,No or Cancel. Images and be added to alert dialog as show here. Key Image is shown.
Alert Dialog is feature of Android. We can define the following
1. set Title.
2. set message
3. set Icon.
4. set positivebutton for Yes button
5. set negativebutton for No button
6. set neutralbutton for cancel button.
  
2.
Alert Dialog with Runnable Thread

This Screen  is on Advertisement of product on Mobile.This Advertisement will dismiss after some time. Here use a runnable thread which will stop after the counter is reached to 10.
We have used alert dialog as Splash Screen.This alert Dialog does not have any button.
Runnable thread is used to dismiss after 10 sec.Images and message  are defined in variable in beginning of program.
Images can be added/edited in program to show a different images and message.
Once we integrate with Backend JSF module. This variables will be updated with PHP select script getting data from server.

  
3.
Show Data from MySql and PHP

This page is an advertisement page. This has four sections.
First section display images which will swap on by one.This is achieved using method setImageResource and changing image.
Second section will scroll mages from left to right.This achieved by creating runnable thread and using smoothScrollBy method.
Third section will get the data from MySql and PHP select script and display data in ListView.
Fourth section will get the data from MySql and PHP select script and display data in TextView as scrollable, Marquee effect.

 
4.
Login Feature

When Icon Key is  pressed This Login screen will appear. The username and password is validated from database.
User name is displayed with welcome message if it exist else error message is displayed.
New user can be added and saved on press of Register button. The data is saved in MySql database with PHP insert script.
This Login page is also a dialog page which is specified as Dialog activity. In AndroidManifest.xml we specify as
android:theme="@style/Theme.AppCompat.Dialog"

 
5.
Store User Data at Application Level.

Once user name and password is validated. User name, user code and Mobile no is saved at Application level based on global class defined.

Username is used to save data at cart level and at tracking level.

 
6.
Resize,Sorting and Dynamic Multicolumn features.

Catalogue Items are listed for the customer to view and select.

The data is selected from MySql and PHP select script from Items table. We create ListAdapter to show data in ListView.

At the top screen we have the following buttons -
Resize, Multicolumn and Sorting up or down .

Following features are developed for data

1. Items can be sorted on price.
2. Items can be resized.
3. Items can be in column of 1,2 and 3.

On Press of  ‘Add to Cart’ the data is inserted to Cart Table in MySql database with PHP insert script.

 
7.
Image,Button and Text using AsyncTask.

Once the item is selected and added to cart. They can be monitored based on Master data.

The master data have have list of activities as ‘Order Booked, Order placed to vendor. etc. This is the list of process of the shopping cart Application will flow at backend ( which is monitored with backend Application created in JSF)
Any change in data will be shown with date in ListView for each Item and for Customer. Once Pay button is pressed the order is booked with booked data.

The data is shown from Cart table from MySql and PHP select script.

 
8.
Send SMS from ListView
On Press of button ‘Pay’ SMS will be send to customer based on Item selected from ListView and Mobile No. saved at Application Level.

Here we use Implicit Intent to send SMS. Item name and mobile no is taken to define message and is taken from global class  defined at Application level.

 
9.
Send Email with Inline Images with Text

Help Button is pressed and it will start the Email activity.
This page has two options

Option 1: Take a Photo  of product which could be a book and mention the issue in heading and  footer text and send as Email.
Option 2: Click an Image and save in Image gallery. get the Image  from Gallery and send as Email. The images will scroll in gallery at bottom and on click will show in Image box.

We create Email as Multipart to include Image and Text.
We  define AsyncTask to send Email. Mail property is set for Gmail.

 
10.
Image Animation

On Top Bar  show four Icons

1. Help. – This will have the animation of zoom in and zoom out.
2.Login. – This will have the animation of Blink.
3.Cart.   - This will have the animation of tilt on both side.
4. Tracking. – This will have the animation of Moving left to right and reverse.

It will also show the name of user logged in.

 

11.
The Page layout has two Main layouts- Relative and Linear Layouts. Controls are defined within Linear Layouts. A general Layout used for all pages design is shown below.
  • Relative Layout
    • Previous Button . This is defined in relative Layout.
    • Linear Layout
      • Text View  / Image View/ List View.

activity_main.xml

Projects and Tutorials Links

Shopping Cart Application. 

YouTube Video Link    : Android Tutorial Videos 
Blog Link                   Android Shopping Cart Blog 

Integrate Android and JSF 2.2 Shopping Cart Application Link: Integrate JSF 2.2 and Android Shopping Cart Applications.

For Diet meter one should see the Android SQLIte Link.Andorid SqlLite Blog