Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Sample Code >

app - API Demos

Activity

Hello World
Demonstrates a basic screen activity.
Code:
HelloWorld.java
Layout:
hello_world.xml
Save & Restore State
Demonstrates how an activity should save state when it is paused.
Persistent State
Demonstrates how you can save and restore preferences, which are stored even after the user closes the application.
Receive Result
Demonstrates how an activity screen can return a result to the activity that opened it.
Forwarding
Demonstrates opening a new activity and removing the current activity from the history stack, so that when the user later presses BACK they will not see the intermediate activity.
Redirection
Demonstrates how to save data to preferences and use it to determine which activity to open next.
Translucent
Demonstrates how to make an activity with a transparent background.
TranslucentBlur
Demonstrates how to make an activity with a transparent background with a special effect (blur).

Service

Local Service Controller
Starts and stops the service class LocalService that runs in the same process as the activity, to demonstrate a service's lifecycle when using {@link android.content.Context#startService Context.startService} and {@link android.content.Context#stopService Context.stopService}.
Local Service Binding
Demonstrates binding to a service class LocalService that runs in the same process as the activity, to demonstrate using the {@link android.content.Context#bindService Context.bindService} and {@link android.content.Context#unbindService Context.unindService} methods with a service. This also shows how you can simplify working with a service when you know it will only run in your own process.
Remote Service Controller
Demonstrates starting a service in a separate process, by assigning android:process=":remote" to the service in the AndroidManifest.xml file.
Remote Service Binding
Demonstrates binding to a remote service, similar to the Local Service Binding sample, but illustrating the additional work (defining aidl interfaces) needed to interact with a service in another process. Also shows how a service can publish multiple interfaces and implement callbacks to its clients.
Service Start Arguments Controller
Demonstrates how you can use a Service as a job queue, where you submit jobs to it with {@link android.content.Context#startService Context.startService} instead of binding to the service. Such a service automatically stops itself once all jobs have been processed. This can be a very convenient way to interact with a service when you do not need a result back from it.
Code:
ServiceStartArgumentsController.java
ServiceStartArguments.java
Layout:
service_start_arguments_controller.xml

Alarm

Alarm Controller
Demonstrates two ways you can schedule alarms: a one-shot alarm that will happen once at a given time, and a repeating alarm that will happen first at a given time and then continually trigger at regular intervals after that.
Code:
AlarmController.java
OneShotAlarm.java
RepeatingAlarm.java
Layout:
alarm_controller.xml
Alarm Service
Demonstrates how you can schedule an alarm that causes a service to be started. This is useful when you want to schedule alarms that initiate long-running operations, such as retrieving recent e-mails.
Code:
AlarmService.java
AlarmService_Service.java
Layout:
alarm_service.xml

Notification

NotifyWithText
Demonstrates popup notifications of varying length.
IncomingMessage
Demonstrates sending persistent and transient notifications, with a View object in the notification. It also demonstrated inflating a View object from an XML layout resource.

Search

SearchInvoke
Demonstrates various ways in which activities can launch the Search UI.
SearchQueryResults
Demonstrates an activity that receives Search intents and handles them.
SearchSuggestionSampleProvider
Demonstrates how to configure and use the built-in "recent queries" suggestion provider.

Files


 
 
  Published under the terms fo the Apache 2.0 License Design by Interspire