Skip to main content

Posts

Toggle Button in Android

Toggle Button in Android Displays checked/unchecked states as a button with a "light" indicator and by default  accompanied with the text "ON" or "OFF". main.xml <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:orientation = "vertical"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent"     >     < LinearLayout     android:id = "@+id/linearLayout1"     android:layout_width = "match_parent"     android:layout_height = "wrap_content" >         < TextView          android:text = "Select"         android:id = "@+id/textView1"         android:layout_width = "wrap_content"         android:layout_height = "wrap_content" >         </ TextView >         < ToggleButton   

AutoCompleteTextView in Android

AutoCompleteTextView  in Android AutoCompleteTextView   is 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. main.xml <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:orientation = "vertical"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent"     >     < AutoCompleteTextView android:id = "@+id/myautocomplete"       android:layout_width = "fill_parent"       android:layout_height = "wrap_content"       android:completionThreshold = "1"       /> </ LinearLayout > AutoCompleteExampleActivity.java package com.example.autocomplete; import andr

Spinner in Android/Spinner Example/Simple Spinner Program

Spinner in Android/Spinner Example/Simple Spinner Program Spinner is a widget similar to a drop-down list for selecting items .  Create an array of items to be  displayed String androidphones []={ "Sony Ericson Xperia" , "Motorola Droid" , "Samsung Galaxy" , "HTC Sensation" , "LG Nitro" , "Google Nexus" }; Add an array adapter to display the spinner spinner .setAdapter( new ArrayAdapter<String>( this , android.R.layout. simple_spinner_item , androidphones )); In spite of android.R.layout. simple_spinner_item , you can also add android.R.layout.simple_spinner_dropdown_item                           or android.R.layout.simple_dropdown_item_1line Source code main.xml <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:orientation = "vertical"     android:layout_width = "fill_
Motorola Flipout Motorola Defy Plus Motorola Fire XT Motorola Fire Motorola Quench XT5 Motorola RAZR Motorola Atrix 2 Motorola Backflip Motorola Charm Motorola Defy Motorola Milestone XT720 Motorola Quench XT3 Motorola Milestone XT800