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 :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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 :
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.
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.
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:
7.2.Linear Layout:
7.3.Frame Layout :
Download Codes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No comments:
Post a Comment