Thursday, 21 August 2014

Android Sample Coding-PART 8:


1.JSON:


            JSON  is very light weight, structured, easy to parse and much human readable. JSON is best alternative to XML when your android app needs to interchange data with your server.

JSON is one of the best method for storing data. JSON data has both square brackets and curly brackets. The square brackets denote JSON Array and curly bracket denotes JSON Object. 


Screenshot :

          JSON Structure:









  Download Code Here

             JSON Parsing

         

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thursday, 14 August 2014

Android Sample Coding-PART 7:


1.SQLITE:


            SQLITE  is an Open Source Database which is embedded into Android. SQLite supports standard relational database features like SQL syntax, transactions and prepared statements. In addition it requires only little memory at runtime (approx. 250 KByte).

SQLite supports the data types TEXT (similar to String in Java), INTEGER (similar to long in Java) andREAL (similar to double in Java). All other types must be converted into one of these fields before saving them in the database. SQLite itself does not validate if the types written to the columns are actually of the defined type, e.g. you can write an integer into a string column and vice versa. 



Screenshot :

          













  Download Code Here

             SQLITE Example1

             SQLITE Example2

             SQLITE Example3

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.Shared Preferences:


            SharedPreferences   class provides general framework that allows you to save  and retreive persistent key-value pairs of primitive datatypes. 



Screenshot :

          







  Download Code Here

             Shared Preference

           

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.Shared Preferences Using SESSION:


            SharedPreferences   class provides general framework that allows you to save  and retreive persistent key-value pairs of primitive datatypes. 


Screenshot :

          








  Download Code Here

             Shared Preference

           

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tuesday, 12 August 2014

Android Sample Coding-PART 6:


1.Fragment:


            Fragment class in Android is used to build dynamic User Interfaces. Fragments should be used within the Activity. A greatest advantage of fragments is that it simplifies the task of creating UI for multiple screen sizes. A activity can contain any number of fragments.



Screenshot :

          






  Download Code Here

             Fragment

          

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.Sliding Navigation Drawer:


            Sliding Navigation Drawer which is revealed when you swipe across the screen from left edge , which would be hidden rest of time.


Screenshot :

          








  Download Code Here

             Sliding Navigation Drawer

          

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.Drag and Drop:


            Drag Drop  can be used to drag data from a view and drop it in another view.


Screenshot :

          






  Download Code Here

             DragnDrop

          

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.Text Watcher:


            Text Watcher   can be used to watch a input text field and you can instantly update data on other views. It can be useful for counting the number of characters entered in the text field instantly and measuring password strength on entering etc .


Screenshot :

          








  Download Code Here

             TextWatcher

          

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Monday, 11 August 2014

Android Sample Coding-PART 5:


1.Progress Bar:


            Progress Bar  are used to show progress of a task. For example. When you are uploading or downloading something from the internet, it is better to show the progress of download/upload to the user.
 <ProgressBar
     style="@android:style/Widget.ProgressBar.Horizontal"
     ... />

Other progress bar styles provided by the system include:

  1. Widget.ProgressBar.Horizontal
  2. Widget.ProgressBar.Small
  3. Widget.ProgressBar.Large
  4. Widget.ProgressBar.Inverse
  5. Widget.ProgressBar.Small.Inverse
  6. Widget.ProgressBar.Large.Inverse  

Screenshot :

          1.1. Progress Bar:



   



          1.2.ProgressBar Dialog:





  Download Code Here

             Progress Bar

            ProgressBar Dialog

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.Spinner:


            Spinner  are  not nothing but the dropdownlist seen in other programming languages. It provides a easy way to select  value from  list. Clicking spinner will display a dropdownlist with the available values.

Screenshot :

          




  Download Code Here

             Spinner

          

            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


3.Toggle Button:


            Toggle   button allows the user to change a setting between two states.


You can add a basic toggle button to your layout with the Toggle Button object.


Screenshot :

          





  Download Code Here

             Toggle

         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tuesday, 5 August 2014

Android Sample Coding-PART 4:


1.Grid View:


            Grid View is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.


   Screenshot :

          1.1. Normal Gridview:


     



          1.2.Custom Gridview:

 


  Download Code Here

             Normal GridView

            Custom GridView



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Friday, 1 August 2014

Android Sample Coding-PART 3:


1.Toast:


            Toast is a notification message that pop up, display a certain amount of time, and automatically fades in and out, most people just use it for debugging purpose.

//display in short period of time
Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_SHORT).show();
 
//display in long period of time
Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_LONG).show();


   Screenshot :

          1.1. Normal Toast :

       



          1.2.Custom Toast:

 

  Download Code Here

             Normal Toast

            Custom Toast




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


2.Alert Dialog:


            Alert Dialog class can be used,where a message and one,two or three buttons are displayed in a popup window.

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
    context);


   Screenshot :

    



  Download Code Here

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.Custom Dialog:


            Custom Dialog is usually a small window that appears in  front of the current Activity. The underlying Activity loses focus and the dialog accepts all user interaction. Dialogs are normally used for  notifications that should interrupt the user and to perform short tasks that directly relate to the application in progress (such as a progress bar or a login prompt).

 AlertDialog.Builder builder = new AlertDialog.Builder(this);

   Screenshot :

        





  Download Code Here

     

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.List View:


            List View  arranges components in a vertical scroll able list.

   Screenshot :

         




  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.1. Custom ListView:


            Custom ListView    is explained how to design listview with your custom styles and colors instead of using default listview style.

   Screenshot :

         




  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.2. Expandable List View:


            Expandable List View  is used to group list data by categories. It has the capability of expanding and collapsing the groups when user touches header.

   Screenshot :

         




  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4.3. Search In List View:


            Adding search functionality to listview   will filters the list data with a matching string, hence provides user an easy way to find the information he needs.

   Screenshot :

         


  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

5.Scroll View:


            Scroll View  Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.

   Screenshot :

         





  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6. Horizontal Scroll View:


            Horizontal Scroll View  Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.

   Screenshot :

         





  Download Code Here            

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~