Langsung ke konten utama

Postingan

Switch Example

switch example in android.   We require API level 14 activity_main.xml < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     tools:context = ".MainActivity" >     < Switch         android:id = "@+id/main_switch1"         android:layout_width = "wrap_content"         android:layout_height = "wrap_content"         android:layout_alignParentLeft = "true"         android:layout_marginLeft = "27dp"         android:layout_marginTop = "46dp"         android:text = "Switch" /> </ RelativeLayout...

WebView Example

activity_main.xml < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     tools:context = ".MainActivity" >     < WebView         android:id = "@+id/webView1"         android:layout_width = "match_parent"         android:layout_height = "match_parent"         android:layout_alignParentLeft = "true"         android:layout_alignParentTop = "true" /> </ RelativeLayout > MainActivity.java package com.swamys.webviewexample; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class MainActivity extends Activity {  ...

NumberPickerDialog Example

For Number Picker Dialog we require minimum API Level 11 Strings.xml <? xml version = "1.0" encoding = "utf-8" ?> < resources >     < string name = "app_name" > Number Picker Dialog </ string >     < string name = "button_name" > Get Number </ string > </ resources > activity_main.xml < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     tools:context = ".MainActivity" >     < NumberPicker         android:id = "@+id/numberPicker1"         android:layout_width = "wrap_content"         android:layout_height = "wrap_content"       ...

TimePickerDialog Example

ScreenShots: strings.xml <? xml version = "1.0" encoding = "utf-8" ?> < resources >     < string name = "app_name" > Time Picker Dialog </ string >     < string name = "button_name" > Pick Time </ string > </ resources > activity_main.xml < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     tools:context = ".MainActivity" >     < Button         android:id = "@+id/button_pickdate"         android:layout_width = "wrap_content"         android:layout_height = "wrap_content"         android:layout_alignParentTop = "true"  ...

DatePickerDialog Example

Date Picker Dialog Example in Android ScreenShots: Strings.xml <? xml version = "1.0" encoding = "utf-8" ?> < resources >     < string name = "app_name" > Date Picker Dialog </ string >     < string name = "button_name" > Pick Date </ string > </ resources > Activity_main.xml < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     tools:context = ".MainActivity" >     < Button         android:id = "@+id/button_pickdate"         android:layout_width = "wrap_content"         android:layout_height = "wrap_content"         android:lay...