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            

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

Wednesday, 30 July 2014

Android Sample Coding-PART 2:


1.Content Providers:



            Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.



   Screenshot :

          1.1. Normal Page :

           1.2.Add Title :

          1.3.Retrieve Title:

   

  Download Code Here


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

2.Edit Text:


            EditText is a thin veneer over TextView that configures itself to be editable.



   Screenshot :

         





  Download Code Here

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

3.Radio Button:


            Radio button is a two-states button that can be either checked or unchecked. When the radio button is unchecked, the user can press or click it to check it. However, contrary to a check box , a radio button cannot be unchecked by the user once checked.


Radio buttons are normally used together in a Radio Group.



   Screenshot :

         








  Download Code Here

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


4.Check Box:


            Check box is a specific type of two-states button that can be either checked or unchecked.

 public class MyActivity extends Activity {
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);

         setContentView(R.layout.content_layout_id);

         final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
         if (checkBox.isChecked()) {
             checkBox.setChecked(false);
         }
     }
 }
 


   Screenshot :

         








  Download Code Here

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



5.Auto Complete Text View:

          An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.

   The drop down can be dismissed at any time by pressing the back key or, if no item is selected in the drop down, by pressing the enter/dpad center key.

   The list of suggestions is obtained from a data adapter and appears only after a given number of characters defined by the threshold.

 public class CountriesActivity extends Activity {
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         setContentView(R.layout.countries);

         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                 android.R.layout.simple_dropdown_item_1line, COUNTRIES);
         AutoCompleteTextView textView = (AutoCompleteTextView)
                 findViewById(R.id.countries_list);
         textView.setAdapter(adapter);
     }

     private static final String[] COUNTRIES = new String[] {
         "Belgium", "France", "Italy", "Germany", "Spain"
     };
 }
 


   Screenshot :

         








  Download Code Here

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

6.Splash Screen:

          splash screen to all new users when they first open the app.


   Screenshot :

         


  Download Code Here

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

7.Layouts:



            Layouts can classified into the following ways:

 1. Relative Layout,
 2. Linear Layout,
 3. Frame Layout,
 4. Grid Layout,
 5. Table Layout,
 6. List View,
 7. Web view.


 7.1.Relative Layout :

            Relative Layout let you position your component base on the nearby (relative or sibling) component’s position. It’s the most flexible layout, that allow you to position your component to display in anywhere you want (if you know how to “relative” it).



7.2.Linear Layout :

           Linear Layout  is a common layout that arranges “component” in vertical or horizontal order, via orientation attribute. In additional, the highest “weight” component will fill up the remaining space in Linear Layout.


7.3.Frame Layout :
           Frame Layout  is designed to display a single item at a time. you can have multiple elements within the Frame Layout but each element will be positioned based on the top left of the screen.
We mainly use this Layout manager to display a single view but we can populate it with many items setting one to visible and others to invisible.

7.4.Grid Layout :
           Grid Layout  is a view that shows items in two-dimensional scrolling grid. The items in the grid come from the List Adapter associated with this view.

7.5.Table Layout :
           Table Layout  let you arranges components in rows and columns, just like the standard table layout in HTML, <tr> and <td>.


7.6.List View :
          List view let you arranges components in a vertical scrollable list.

We will show you 2 ListView examples :

* Normal way to display components in ListView.
* Custom array adapter to customize the item display in ListView.

7.7.Web View :

          Web view allows you to open an own windows for viewing URL or custom html markup page.      
     

   Screenshot :

          7.1.Relative Layout :
           7.2.Linear Layout:
           7.3.Frame Layout :


           7.4.Grid Layout:
           7.5.Table Layout:
           7.6.List View:
           7.7.Web View:


           

  Download Codes:





 



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