: Follow us
Blog Ocean
  • Home
  • Blog
    • Technology
    • Women >
      • Contest
    • Fiction
    • Personal / Daily Life
    • News and Media
    • Sports
    • Religion
  • Guestbook
  • Contact

Create SqlLite Database and Table in Android

20/1/2014

0 Comments

 
Android Database and TableAndroid Database and Table
SqlLite database is an integral part of an application that is used for local storage. The advantage SqlLite database offers are:
  • Simple and easy to administer
  • Small and reliable.
  • Can be embedded into a large program

In android, SqlLite is most commonly used database. Here we are going to create a sqllite database and table.

Account database:

Let’s think about an account database. Generally a database contain several tables to fullfil its purpose. Here we will create a database and make one table.

Let, our table will store account no and account name of the account holder. Account no is primary key. Look at the structure of the table given below:

Database name: accountDB

Table name: accountInfo
Table structure:
 




Create new application:

We are going to create a new application using eclipse editor. Go to New->project->android application project. Name the application and complete other configurations. Set launcher activity name to MainActivity.

Look at our MainActivity class.

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        MyDBHandler db = new MyDBHandler(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

Consider this line:
 MyDBHandler db = new MyDBHandler(this);

It is used to make a database handler for our program. In the following section, we are going to discuss about the database handler class.

Create a database handler class named MyDBHandler.  All the information about database, table, and attributes of the table will be specified here. In onCreate function, table accountInfo will be created. In onUpgrade function, database will be upgraded to new version.

public class MyDBHandler extends SQLiteOpenHelper {
           
            private static final int DATABASE_VERSION = 1;

            // Database Name
            private static final String DATABASE_NAME = "accountDB";

            // Contacts table name
            private static final String TABLE_ACCOUNT = "accountInfo";

            // Contacts Table Columns names
            private static final String KEY_ACNO = "accountNo";
            private static final String KEY_NAME = "accountName";

            public MyDBHandler(Context context) {
                        super(context, DATABASE_NAME, null, DATABASE_VERSION);
            }

            @Override
            public void onCreate(SQLiteDatabase db) {
                        // TODO Auto-generated method stub
                        String CREATE_ACCOUNT_TABLE = "CREATE TABLE " + TABLE_ACCOUNT + "("
                                                + KEY_ACNO + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT" + ")";
                        db.execSQL(CREATE_ACCOUNT_TABLE);
            }

            @Override
            public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
                        // TODO Auto-generated method stub
                        db.execSQL("DROP TABLE IF EXISTS " + TABLE_ACCOUNT);

                        // Create tables again
                        onCreate(db); 
            }
}

Create a class named Account. It will be used to set account information and retrieve the information. This class is used to perform CRUD (Create, Read, Update and Delete) operations in database. For now, this operation is out of scope for us in this article. We are just going to look at the class. 

public class Account {
           
            int accountNo;
            String accountName;
           
            // empty constructor
            public Account(){
            }

            // constructor
            public Account(int accountNo, String accountName){
                        this.accountNo = accountNo;
                        this.accountName = accountName;
            }
           
            // get account no
                        public int getAccNo(){
                                    return this.accountNo;
                        }
                       
                        // set account no
                        public void setAccNo(int accNo){
                                    this.accountNo = accNo;
                        }
                       
                        // get account name
                        public String getAccName(){
                                    return this.accountName;
                        }
                       
                        // set account name
                        public void setAccName(String accName){
                                    this.accountName = accName;
                        }
}

Here is a brief about the stated function.

Account(): Constructor,  set account no and name.
setAccNo(): Set the account no
getAccNo(): get the account no
setAccName(): Set the account name
getAccName():  Get the account name.

From this article, we have learnt how to create SqlLite database and table. But if we want to use the database, we would have to learn how to perform CRUD(create, read, update, delete) operations.


Also know android project structure to start developing Apps and game in android and Working with bitmap image to see how Guess Who? image apps are created in Android.


0 Comments

Android Project Structure

20/1/2014

0 Comments

 
Android app development - Android project structure 1
Apps and game development in android is a very promising profession now-a day. One must know Android project structure if they want to develop the career in Android based development.

Create a new project:

First, we would create a new project using eclipse. In different steps of project creation, we will configure the application which will affect some of our project configuration files.

 Step 1: File->new->project->android application project

Here, we have namedour application, package name under which the application will run; build sdk version and minimum sdk version. Minimum sdk version is required to make your application backward compatible, i.e. to run into previous android OS based device.


Read More
0 Comments

Android Kitkat :  A Smarter & Immersive Operating System

26/12/2013

0 Comments

 
Android kitkat 4.4 onscreen caption
Android kitkat 4.4 - Onscreen caption
Android kitkat 4.4 immersive and multitaskingAndroid kitkat 4.4 multitasking
Android Kitkat is the most recent and advanced version of Android operating system released by Google with its overhauled features and amazing updates. It is enhanced with brilliant updates making it faster, smarter, more pleasing to users and also sufficiently efficient to compete with the contemporary operating systems.

Immersive mode
Android 4.4 includes many exciting features among which Full-screen Immersive mode is one which allows using the full screen while reading document or watching movie by hiding all system UI. The immersive mode hides the unnecessary files and keeps open only the current app the user is using. For returning to the status bar and navigation buttons,  a simple swipe is required.

Faster and smarter multitasking
Sufficient advancement has taken place in Android 4.4 in regard to multitasking resulting in a smarter operating system. It has achieved up gradation from its previous versions with faster response, more optimized memory and better touch screen. A number of works can be run simultaneously and smoothly at a fast speed, like playing games, listening to music, browsing internet or reading books etc. It is capable of running on devices with as little as 512MB of RAM and has contributed to better memory management. 

Chromium WebView
A new Chromium based web view has been introduced in Android Kitkat in which HTML5, CSS3, and JavaScript are supported .Remote debugging with Chrome DevTools and introduction of latest the JavaScript Engine (V8) are some mention worthy addition to enhance the capability of the operating system. Inspection, debugging, and analyzing WebView content live on a mobile device has benefited the users to a wider extent.

Better accessibility experience across apps
The apps can now be easily reached in this new OS with system-wide preferences for Closed Captioning. Users can set global captioning preferences by going through Settings > Accessibility > Captions. Language, text size, and text style to use can be altered more easily according to user’s preference and will. The captioning manager helps to adjust scaling factor, text style. This is very useful to exercise user’s preference. Apps using videos have also gone through enormous advancement because of the inclusion of captioning manager. Apps that use video can display on screen captions if the user specifies the settings accordingly. (See top image)

Improved Caller ID
In Kitkat, contacts can be directly found from the dial pad and corporate directory can be searched easily. From the search field of the dialer, a business’s contact information enlisted in Google Maps can be searched which is a milestone in promoting business and corporate world. Security issues have been strengthened because of its ability to identify unknown numbers and cross-checking the number with nearby businesses

Assimilation with Cloud Storage
Cloud storage is an awesome technology to save documents even after running out of local device’s memory. The users do not need to store documents in device. Files can be opened, processed and saved directly from cloud. Kitkat comes with the support for cloud storage solution like google drive built into the OS. Some apps as QuickOffice already facilitates user through this feature.

Compatibility for printing
Printing of photos and documents has become quite easy as a result of incorporation of Google Cloud Print directly into Android 4.4 . But this opportunity is viable only for compatible devices with wireless connectivity and support for Google Cloud Print.

Introduction of voice command “Ok Google”
In addition to option of giving command by touch screen, voice commands have been introduced to make phones more user friendly. When the user is on home screen or in Google Now, voice search can be launched and sending a text, getting directions or even playing a song can be done by just saying “Ok Google”.

Android kitkat 4.4 - Voice commands
Android kitkat 4.4 - Voice commands
Are you impressed with the changes and comment with your wishlist of features that should be added to androids next operating system.

Read also features of Apple's new operating system iOS 7 and android camera Samsung Galaxy features which has created new market between by introducing android based camera.
0 Comments

Android Camera - What makes SAMSUNG GALAXY CAMERA Exclusive?

25/12/2013

0 Comments

 
Android CameraAndroid Camera
Galaxy camera is a revolutionary innovation offered by Samsung combining the technologies of Smartphone and camera which gives the users experience of android OS driven camera. Samsung withholds the strongest position in presenting the best ever and rare smart cameras. Except for calling, it facilitates every amenity of smartphone, like messaging and making VoIP calls from apps like Skype .It is quite different from other traditional compact cameras with its impressive photography, vivid functionality and intuitive interface.

With its 16-megapixel sensor, a 21x optical zoom, 3G/4G connectivity, WiFi, GPS, a 4.8-inch touchscreen display, it has rapidly gained its extensive popularity.

Experience of a wide LCD screen Regarding the size of the camera, it is a little larger than the traditional ones for its protruding 21x zoom lens and gargantuan touchscreen. The bigger screen is quite different from any compact camera which offers a charm of shot in LCD screen.

Improved Lens The lens of the camera makes the difference with smartphone cameras is its optical zoom lens which enhances the capability of mobile photography. In the samrtphones, no optical zoom remains. With 21x zoom, The F2.8-5.9 4.1-86.1mm lens appears as a good choice of travel camera and can efficiently compete with other cameras. Acoustics is also fantastic and also the option of slow motion video.

Voice commands

One outstanding thing about the camera is the option to give voice commands.  The camera can be operated without touch by giving voice commands only. Commands that can be given are as follows:

Take Pictures: say “smile,” “cheese,” “capture,” and “shoot.”
Record Video: say “record video.”Change to auto mode: say “auto settings.” 
Change to beauty face mode: say “beauty face.” 
Control zoom: say “zoom in” and “zoom out.”
Control flash: say “flash on” and “flash off.”
Go to Gallery: say “gallery.”
Take picture after 10 seconds: say "timer."

Smart Mode

15 smart modes are incorporated in the camera that makes the difference with normal digital cameras. Some of these are Best Face (selects and changes facial expressions instantly), Beauty Face (takes softly focused portraits), Fireworks (captures fireworks at night) Light Trace (takes pictures of light trails using long exposure at night, Waterfall (captures waterfalls and flowing water), Silhouette (takes pictures of Silhouette with backlighting).

Samsung Galaxy Camera is very user friendly like other all round Android devices. It operates in three modes: Auto, Smart or Expert Mode PASM (Program, Aperture priority, Shutter priority, and Manual) options are available in Expert mode. There are also more common options such as a Macro, Panorama, Smart Night and Best Photo mode. Aperture priority, shutter priority and manual exposure also meet the appeal of experienced photographers.

Social networking

A strong point for Galaxy Camera is its achievement in promoting social networking. Features of smartphones have been incorporated in the device that has added to its widespread popularity. The snaps taken can be shared instantly through Email, Google+, Dropbox having WiFi connection or 3G/4G or direct via Bluetooth, Share Shot, Buddy Photo Share. Apps in the Google Play store can be accessed easily.

Built in apps for photo editing

On board editing has added to the standout appeal of the camera.  Samsung Galaxy has creative apps, like Photo Wizard, Instagram and Paper Artist preloaded in it. Paper Artist helps to give artistic effect to photos whereas Photo Wizard helps to insert text, music in videos and shuffle video scenes. Hundreds of editing tools can be availed by installing apps to enhance image quality.

Instant sharing with Share Shot

The camera avails the cool Share Shot that helps the users share photos or video instantly once a photo or video has been captured. It helps to share photos with up to 5 other Wi-Fi direct devices within range and let the friends and family of users get updated with the user’s latest state.

There are some shortcomings we discovered for the phone. The image quality, resolution and details are great in good lighting and with the right subjects, with good detail and resolution but it offer some problem in darkness. Sometimes image noise occurs while using high ISO settings. Another problem is the camera only saves images in JPEG format and it does Not have ability to shoot RAW.


Also go through our post of android app development and see working with bitmap images to create and app or game like guess who?


0 Comments

Android Apps Development : Working with bitmap image

23/12/2013

0 Comments

 
Android app development - bitmap image 1
Playing with image is always a fun. Now we are going to explore this type of fun in android. Have you ever played a game where part of a picture is shown to you and you are asked whose picture is it? Our target is to develop such an app in android with bitmap image.


Clue 1:

Android app development bitmap image 2




Clue 2:

Android app development bitmap image 3




Clue 3:

Android app development bitmap image 4




Clue 4:


Read More
0 Comments

    RSS Feed

    Author

    Vaibhav O Yadav - Top IT professional. Worked with Fortune 100 company. I like to spread the knowledge. Analyse situation and environment with long term vision and solution. Firm believer of sustainable development for earth. Apart from from being geeky also like to play multitude variety of video games on greater stretch of time with favorite being economic simulation

    Categories

    All
    Android
    Android App Development
    App Development
    Apple
    Cloud
    Data Virtualization
    Data Warehouse
    Virtualization
    Wordpress

    Archives

    October 2014
    March 2014
    January 2014
    December 2013

    Tweets by @BlogOcean

Home

Blog

Guestbook

Contact
Follow @BlogOcean

© 2013 - 2014 BlogOcean HQ
All rights reserved.