Sunteți pe pagina 1din 29

15/07/2015

Android Examples With Source Code | Techblogon

Home
About us
Contact us
Privacy Policy

Tutorials
Gadgets
Internet
Technologies

Android Examples With Source Code


February 3, 2013 Android Tutorial, Tutorials
Android Examples with Source Code and Description
Here you can download verities of Android Examples with Source Code. To help you understand some
fundamental Android APIs and coding practices, a variety of examples and source code are available along with
the Android SDK Manager. Each version of the Android platform available with the SDK Manager offers its
own set of sample codes for verities of android applications. Also You can download examples with source
code for Android Applications from here. Below is the screen shot from the API Demos application. Once you
will click on each category, we will find and run related android apps listed below.
You can find the source code for all samples at this location in your local PC, where you downloaded/extracted
Android SDK:
<sdk>/samples/android-<version>/

The <version>number corresponds to the platforms API level.


Example: ~\android-sdk-windows\samples\android-8\
In my PC, I have extracted android DK in my E:\ Drive. So sample codes location in my PC is :
E:\Android\android-sdk-windows\samples\android-8\
You can easily create new Android projects with the downloaded samples, modify them if youd like, and then
run them on an emulator or device.
Note: If you did not install sample codes before with Android SKD, then also you can install now. Follow
http://techblogon.com/android-examples-with-source-code-download/

1/29

15/07/2015

Android Examples With Source Code | Techblogon

below steps.
To Download Samples from Web:
1. Launch the Android SDK Manager.
On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
On Mac or Linux, open a terminal to the tools/directory in the Android SDK, then
execute android sdk.
2. Expand the list of packages for the latest Android platform.
3. Select and download Samples for SDK.
Note: While trying the above steps, you might face some issues. You can go through my article Some Common
Android Development Errors and Solutions.

Download More than 100 Android Examples with Sample Code in a Single Project
If you are not able to download or find default android sample codes from internet, then dont worry. You can
download all android API sample codes from here. I have uploaded more than 100 android examples with
source code inside a single project, Once you download the project from here, then you can find the below
list of android Sample codes and examples from that project. You can run each example on Android Emulator
or Real Device. Some samples codes might not work in Emulator as they are hardware dependent. But you can
run those in real device. You will find below List of Examples with Source Code once you download the project
from here. I have sub categorized all sample examples like below. All the below android examples has been
build and tested on Android Version 2.2 with SDK Min API Version 8. You can Run on higher Android OS as
well.
Before Start downloading all Android Examples with Source Code from here, Please read this post carefully.
Note: All examples has been packaged as different categories in the code. Each package having verities of
examples similar to that package as i have explained below. Have a look into below image for better
understanding. When you open the project, you will find these packages in the source code.

http://techblogon.com/android-examples-with-source-code-download/

2/29

15/07/2015

Android Examples With Source Code | Techblogon

Download the APIDemos_apk.zip from here . Then unzip the downloaded file (APIDemos_apk.zip) and
run on your Emulator/Device. Then check if your required android example is available in this project.

1. App Examples In Android


Action Bar Example in Android
Activity Example in Android
Alram Example in Android
Device Admin Example in Android
Dialog Example in Android
Intents Example in Android
Launcher Shortcuts Example in Android
Menus Example in Android
Notification Example in Android
http://techblogon.com/android-examples-with-source-code-download/

3/29

15/07/2015

Android Examples With Source Code | Techblogon

Preferences Example in Android


Search Example in Android
Services Example in Android
Text-To-Speech Example in Android
Voice Recognition Example in Android

2. Content Examples In Android


Assets Examples in Android
Clipboard Example in Android
Provider Example in Android
Resources Examples in Android
Storage Example in Android
http://techblogon.com/android-examples-with-source-code-download/

4/29

15/07/2015

Android Examples With Source Code | Techblogon

3. Media
AudioFx
Media Player Example in Android
VideoView Example in Android

http://techblogon.com/android-examples-with-source-code-download/

5/29

15/07/2015

Android Examples With Source Code | Techblogon

4. OS Examples in Android
Morse Code (Vibration) Example in Android
Rotation Vector Example in Android
Sensors Example in Android
SMS Messaging Example in Android

http://techblogon.com/android-examples-with-source-code-download/

6/29

15/07/2015

Android Examples With Source Code | Techblogon

5. Text Examples in Android


Linkify Example in Android
LogTextBox Example in Android
Marquee Example in Android

http://techblogon.com/android-examples-with-source-code-download/

7/29

15/07/2015

Android Examples With Source Code | Techblogon

6. Views Examples in Android


Amination Example in Android
Auto Complete Example in Android
Buttons Example in Android
Chronometer Example in Android
Controls Example in Android
Custom Example in Android
Date Widgets Example in Android
Expandable Lists Example in Android
Focus Example in Android
Gallery Example in Android
http://techblogon.com/android-examples-with-source-code-download/

8/29

15/07/2015

Android Examples With Source Code | Techblogon

Grid Example in Android


ImageButton Example in Android
ImageSwitcher Example in Android
ImageView Example in Android
Layout Animation Example in Android
Layouts Example in Android
Progress Bar Example in Android
Radio Bar Example in Android
Rating Bar Example in Android
ScrollBars Example in Android
Seek Bar Example in Android
Spinner Example in Android
Tabs Example in Android
TextSwitcher Example in Android
Visibility Example in Android
WebView Example in Android

http://techblogon.com/android-examples-with-source-code-download/

9/29

15/07/2015

Android Examples With Source Code | Techblogon

7. Graphics Examples in Android


AlphaBitmap Example in Android
AnimateDrawables Example in Android
Arcs Example in Android
BitmapDecode Example in Android
BitmapMesh Example in Android
BitmapPixels Example in Android
CameraPreview Example in Android
Clipping Example in Android
ColorMartix Example in Android
Compass Example in Android
http://techblogon.com/android-examples-with-source-code-download/

10/29

15/07/2015

Android Examples With Source Code | Techblogon

CreateBitmap Example in Android


Density Example in Android
Drawable Example in Android
FingerPaint Example in Android
Layers Example in Android
MeasureText Example in Android
OpenGL ES Example in Android
PathEffects Example in Android
PathFillTypes Example in Android
Patterns Example in Android
Pictures Example in Android
Points Example in Android
PolyTopoly Example in Android
PurgeablesBitmaps Example in Android
Regions Example in Android
RoundRects Example in Android
ScaleToFit Example in Android
SensorTest Example in Android
SurfaceView Overlay Example in Android
Sweep Example in Android
Text Align Example in Android
Touch Paint Example in Android
http://techblogon.com/android-examples-with-source-code-download/

11/29

15/07/2015

Android Examples With Source Code | Techblogon

Typefaces Example in Android


Unicode Chat Example in Android
Vertices Example in Android
Xfermodes Example in Android

8. Android Preferences Examples in Android


Preferences from XML Example in Android
Launching preference Example in Android
Preference dependencies Example in Android
Default values Example in Android
Preference from codes Example in Android
Advanced preferences Example in Android
http://techblogon.com/android-examples-with-source-code-download/

12/29

15/07/2015

Android Examples With Source Code | Techblogon

Fragment Example in Android


Headers Example in Android

9. NFC Examples in Android


ForegroundDispatch Example in Android
ForegroundNdefPush Example in Android
TechFilter Example in Android

http://techblogon.com/android-examples-with-source-code-download/

13/29

15/07/2015

Android Examples With Source Code | Techblogon

10. Animation Examples in Android


Bouncing Balls Example in Android
Cloning Balls Example in Android
Custom Evaluator Example in Android
Default Layout Animations Example in Android
Events Example in Android
Hide-Show Animations Example in Android
Layout Animations Example in Android
Loading Example in Android
Multiple Properties Example in Android
Reversing Example in Android
http://techblogon.com/android-examples-with-source-code-download/

14/29

15/07/2015

Android Examples With Source Code | Techblogon

Seeking Example in Android


View Flip Example in Android

Download all above Examples with source codes in a single project from Here.
Note: To run all above downloaded sample codes, you need to build the downloaded project in Eclipse and
install the apk (ApiDemoes.apk), then you can see all categorized examples on the first page once you run the
application on emulator or device.

Custom Android Examples and Sample Codes


For more custom Android Examples and Sample Codes, please click on the next page or go to the Android
Tutorial Home Page. Click below links. You can find verities of custom sample source codes and examples
from here.
Previous Page
Android Tutorial Home Page
Next Page

http://techblogon.com/android-examples-with-source-code-download/

15/29

15/07/2015

Android Examples With Source Code | Techblogon

Post By SmrutiRanjan (57 Posts)

C ONNECT

Working @ Samsung as a Project Lead for Android


Smartphones. I have been blogging since 2008.
Previously I was writing articles for other bloggers, but
finally I have started my own blog-"Techblogon".I am also
an active contributor for the blog-"Gadgets n Gizmos
World". Job is my necessity, but blogging is my passion.
Website: Techblogon

activity sample code in android, android application source code, android examples source code, android
examples source code for begginers, android gui examples, android GUI sample code, android sample codes,
android source code, intent sample code in android, service sample code in android

52 Responses to Android Examples With Source Code


1.

Rinoy Varkey says:


April 2, 2013 at 11:42 am
Hi Ranjan ,
Great website and well done. It is really useful for me. I would be grateful if you could help me use
particular features in your sample code in my apps. Some guidlines that I should follow to use your code.
Thanks
Rinoy
Reply
SmrutiRanjan says:
April 2, 2013 at 5:14 pm
You are welcome
Reply

2.

Dave Tobias says:


April 10, 2013 at 5:51 am
Hi,
I have downloaded the sample code from google using sdk manager. Now I need to know the exact steps
(complete Eclipse newbie) for importing an existing project and running it. I see many people have
answered this question some time ago but not for Eclipse 4.2. When they change the menu structure,
those old instructions are no longer correct. Can you give me the exact steps, assuming nothing to load
one of the sample projects?
Note: My eventual goal is to run some sample app that teaches me how the pen APIs introduced in ICS
work.

http://techblogon.com/android-examples-with-source-code-download/

16/29

15/07/2015

Android Examples With Source Code | Techblogon

Thanks for your consideration!


-Dave
Reply
SmrutiRanjan says:
April 12, 2013 at 3:39 am
it is very simple.
Open Eclipse: Then Goto the menu File->Import.
Then Select Android->Existing Android Code into Work Space.
Then in the Root Directory field, Browse your Android Example Folder (make sure to browse till
the folder which contains all files and folders like res, src, etc).
Then click Finish.
Thats it.
Reply
Haur says:
May 5, 2013 at 6:07 pm
Sir,
After i imported the file, there is an error in com.example.android.apis.os . Whats the
problem? i couldnt launch any android example because of that error or is there anyway to
run a single android example even there is a problem in other android example under the
same project?
Reply
SmrutiRanjan says:
May 6, 2013 at 2:43 pm
please send us the exact error with details, so that i can help you
Reply
3.

sustecha says:
April 13, 2013 at 6:52 am
hello, thanks for your rich example but i have a problem on running app, cause when i am starting to run ,
the package made errors, and stop loading the emulator , need a help , hope to use it
Reply
SmrutiRanjan says:
April 13, 2013 at 1:01 pm

http://techblogon.com/android-examples-with-source-code-download/

17/29

15/07/2015

Android Examples With Source Code | Techblogon

Dear Sustecha,
You might try: First start the emulator and then install your app.
If then also facing the same issue, then look at your DDMS logs, you can find exactly what is going
wrong.
Reply
4.

krishn says:
April 14, 2013 at 4:07 am
how can i vibration phone when i call and when call end.
Reply
SmrutiRanjan says:
April 16, 2013 at 4:02 pm
Goto section 4, you will find the vibration code. Download the code and enjoy.
You need to register a broadcast receiver for call end and call start, then call end. then call vibration
API.
4. OS Examples in Android
Morse Code (Vibration) Example in Android
// Vibrate your mobile phone
Vibrator vib = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vib.vibrate(2000);
Reply

5.

geogeo says:
April 16, 2013 at 12:02 pm
Thanks a lot . U help me to begin
Reply

6.

Karan says:
April 18, 2013 at 4:58 am
Hello! SmrutiRanjan.
Nice post. Very useful.
Can please post an example on Multiple Screen Support.
Reply

7.

Ali Atayurt says:


April 18, 2013 at 12:38 pm

http://techblogon.com/android-examples-with-source-code-download/

18/29

15/07/2015

Android Examples With Source Code | Techblogon

Hello SmrutiRanjan, I have a problem If you help me , am thankful . I have sqlite date base. And 2
tables. Cities and Offices
Tabel 1 :CitID,CitName
Table 2 :OffID,CitID,OffName and have created db.class and city.xml n my xml file I have 2 spinner .
spinner_1,spinner_2
I can load to spinner_1 ,Cities and spinner_2 Offices. But want , when selected spinner1 for ex. select
Kln, spinner2 will load officces for ex Office A, Office B . How can I do this ? Can you send example
for my problem. Do you have open source code ? Help me , please. Thank you very much for your help.
Reply
8.

Lalith says:
April 19, 2013 at 5:42 am
Hi Ranjan
I am new to Eclipse. can you show me how to install the apk (ApiDemoes.apk)to eclipe.
Thank you
Lalith
Reply
SmrutiRanjan says:
April 19, 2013 at 11:52 am
To install ApiDemoes.apk into device or emilator is very easy.
You need to use adb command.
adb install Example:
adb install C:\hellowWorld.apk
More details link below link for where to get abd tool and how to use it.
Link:
http://techblogon.com/adb-commands-for-android-development/
Reply

9.

Kowshik R says:
April 22, 2013 at 9:18 am
Hi sir,
I need source code for android default browser, so please can you help me.
Thank you
Reply

http://techblogon.com/android-examples-with-source-code-download/

19/29

15/07/2015

Android Examples With Source Code | Techblogon

SmrutiRanjan says:
April 22, 2013 at 12:47 pm
Default browser means? do you want to open the default browser or want to know the name of the
default browser?
Reply
Kowshik R says:
April 26, 2013 at 11:21 am
Sir,
i need code for web browser ie(code for bookmarks, code for cookies, and code to save
the sessions), pls help me sir, i have to submit my project within may 23rd.
Thank you.
Reply
10.

Zai May says:


April 24, 2013 at 8:28 am
youre really good Sir..hopefully you will also give some demonstration on making some android
programs..
Reply

11.

K says:
April 25, 2013 at 1:55 pm
the source files (Android-Sample-Codes-with-Examples.zip) provide a lot less samples than the apk does
(ApiDemos_apk.zip)
Reply
SmrutiRanjan says:
April 26, 2013 at 12:08 pm
I have checked , all samples are included in the source code
Reply

12.

madhavi says:
April 26, 2013 at 9:41 am
hai iam working on sms receved notifications i need to display sms on new screen
case1:
if i get one sms i click the notification bar and notification bar launches new scree in that my msg will be

http://techblogon.com/android-examples-with-source-code-download/

20/29

15/07/2015

Android Examples With Source Code | Techblogon

displayed
if i get one message iam able to disply one messge on new screen
but if i get more than two messages i am displaying only latest messge on new screen ,one message is
vanishing(wrong coding).(means iam displaying latestmessge on new screen if i get 2 messges.i lossing to
display 2 messegs.
similary if get 3 ,0r more its happeninh like this
pls help me thanks in andvance
i posted my prob in many sites no one is replied the coreect
how can i resolve my issue
Reply
13.

Kowshik R says:
April 26, 2013 at 2:36 pm
Sir,
i need code for web browser ie(code for bookmarks, code for cookies, and code to save the sessions),
pls help me sir, i have to submit my project within may 23rd.
Thank you.
Reply

14.

Terry says:
April 28, 2013 at 11:14 am
hi brother
i want the all sources codes of apidemos.apk because the apidemos_all.zip only contain apidemos.apk .i
am a beginner and i am very interesting in Android .thank this page is very useful
please help me.
Reply
SmrutiRanjan says:
April 29, 2013 at 4:37 pm
Dear Terry
I have uploaded all source code just below the post.
Have a look again.
Reply

15.

Aykudint says:
April 28, 2013 at 11:07 pm
Thank you very much for your help and comments

http://techblogon.com/android-examples-with-source-code-download/

21/29

15/07/2015

Android Examples With Source Code | Techblogon

Reply
16.

mouaiyad says:
May 8, 2013 at 2:50 pm
error : INSTALL_FAILD_OLDER_SDK
Reply

17.

kartick mishra says:


May 9, 2013 at 5:04 am
Respected Sir,
when i am trying to execude this code in emulator,i am getting error in console.
[2013-05-09 10:27:45 ApiDemos] Installing ApiDemos.apk
[2013-05-09 10:27:51 ApiDemos] Re-installation failed due to different application signatures.
[2013-05-09 10:27:51 ApiDemos] You must perform a full uninstall of the application. WARNING:
This will remove the application data!
[2013-05-09 10:27:51 ApiDemos] Please execute adb uninstall com.example.android.apis in a shell.
[2013-05-09 10:27:51 ApiDemos] Launch canceled!
Reply
SmrutiRanjan says:
May 11, 2013 at 5:55 pm
Dear Kartick,
An older version of API demo already installed in the emulaor. Just uninstall it & then install again
will solve your problem.
thanks
Reply

18.

ravi says:
May 12, 2013 at 6:32 am
please give me some sample code for GPS tracking for this layout
Reply

19.

ravi says:
May 12, 2013 at 6:37 am
How to store selected spinner value in the SQLITE database like selected country,state etc please give
me some example for this sir..
I am searching from last four days for this sir but i didnt found any where

http://techblogon.com/android-examples-with-source-code-download/

22/29

15/07/2015

Android Examples With Source Code | Techblogon

Reply
20.

nani says:
May 13, 2013 at 4:57 am
hi sir,
how to save number of images into video format(sdcard images into one video file), image to video
converting. plz help me.
Reply

21.

Partha says:
May 20, 2013 at 11:18 am
Hi,
I have installed all sdk,eclipse.But when i try to run emulator.exe, nothing is happening and emulator is not
launching.
Can you suggest what is the problem here?
Thanks
Partha
Reply
SmrutiRanjan says:
May 20, 2013 at 11:38 am
It takes some time to launch.
Goto Taskmanager and see if emulator.exe is there or not. if found emulator.exe, just close the
process and start again.
It will take some time (10-15 max) for first time.
Reply

22.

Partha says:
May 20, 2013 at 11:42 am
OK
Let me try once.
Thanks
Partha
Reply

http://techblogon.com/android-examples-with-source-code-download/

23/29

15/07/2015

23.

Android Examples With Source Code | Techblogon

raja says:
May 20, 2013 at 4:52 pm
hai sir
I am new to android.
plz send me some projects with source code
That will help me to put a project into resume(am a fresher).
thank you
Reply

24.

Ankush Aggarwal says:


May 23, 2013 at 8:04 pm
I downloaded the source code and tried importing it into eclipse. But I get an error on a lot of the files and
am therefore not able to install it on my phone
Reply
SmrutiRanjan says:
May 24, 2013 at 9:27 am
You need the latest eclipse setup. indigo version.
Reply

25.

indu says:
May 27, 2013 at 1:40 am
Hi I want to Create a math flash card app using a spinner can you help on it with some samples
Reply

26.

Ravikumar S says:
May 30, 2013 at 8:35 am
Hello Sir,
i am developing an app where image tagging is needed, m confused that how to start. Please help me i
want to develop it as same as markers in maps.
Reply

27.

Swapnil says:
June 10, 2013 at 11:35 am
Hi SmrutiRanjan sir,

http://techblogon.com/android-examples-with-source-code-download/

24/29

15/07/2015

Android Examples With Source Code | Techblogon

is there any multi-threaded code is available here..


actually i am working on a app in which i have to use multi threading. for example one thread is taking care
of UI while other thread is taking care of Bluetooth communication.
if you can give some code to refer then it will be very helpful and i will get the idea how to perform
communication between the threads,
Thanks
Reply
28.

Raj Singh says:


June 19, 2013 at 7:00 am
I really appreciate your attempt to help the android developers at their beginning level, great useful for
students,
It helped me a lot..
Thanks
Please post more on database handling..
Reply

29.

Mike Schwarz says:


July 23, 2013 at 7:58 pm
Sorry for the massive paste. You can delete if need be.
Reply
SmrutiRanjan says:
July 27, 2013 at 6:07 am
Which version of Android SDK you are using?
Reply

30.

harish says:
August 3, 2013 at 11:25 am
there is an error in ForgroungService.java
setForground(true); The method setForeground(boolean) is undefined for the type ForegroundService
Reply

31.

Jason says:
August 19, 2013 at 3:30 am
Hi sir,
Can sir teach me how to develop a Password Manager application in android?

http://techblogon.com/android-examples-with-source-code-download/

25/29

15/07/2015

Android Examples With Source Code | Techblogon

I am new
Reply
32.

Rajeev says:
August 19, 2013 at 10:40 am
Nice dude. .
Just now i hv downloaded that file, i didnt check wheather it is working. . but before that i want to thank
you, bcoz it will be very useful for me as well as lot of peoples. .
Great Job. .
Reply

33.

Vengateswaran says:
August 28, 2013 at 4:31 pm
Thank you so much, i am new to android, when running your sample code i am getting below two
errors.
The method setForeground(boolean) is undefined for the type ForegroundService in
ForegroundService.java and the method is stopForegroundCompat and startForegroundCompat.
Can you please give a solution for this
Reply
SmrutiRanjan says:
August 29, 2013 at 8:11 am
just commented the function setForeground(boolean)
Reply

34.

Jalil Irfan says:


August 30, 2013 at 9:26 am
Hi,
Im in process of making an app where i have four spinners
1st to select the city
2nd the restaurant name,
3rd to display the selected area of that restaurant
3rd to display foods available
it will be used from json
can you kindly help me to get the idea or coding
for these spinners either with the json or with local values

http://techblogon.com/android-examples-with-source-code-download/

26/29

15/07/2015

Android Examples With Source Code | Techblogon

Thanks
Reply
35.

Anand says:
September 24, 2013 at 9:59 am
Thank you for your useful Api demosonce again thanks dude
Reply

36.

justin says:
October 16, 2013 at 8:23 pm
Do you happen to have anything fro add to favorites or bookmarking articles
Reply

Leave a Reply
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
two = 4

Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym
title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del
datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" dataurl=""> <span class="" title="" data-url="">

Post Comment

http://techblogon.com/android-examples-with-source-code-download/

27/29

15/07/2015

Android Examples With Source Code | Techblogon

Search

Techblogon
Follow

+1

+ 305
Like 1,859 people like this. Be the first of your friends.

10

Recommend on Google

Follow @techblogon

216 follow ers

Enter your Email Address...


Subscribe

RSS Feed

Google Plus

Archives
March 2015
July 2014
April 2014
October 2013
August 2013
July 2013
http://techblogon.com/android-examples-with-source-code-download/

28/29

15/07/2015

Android Examples With Source Code | Techblogon

June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012

Categories
Android
Android Tutorial
Design Patterns
Displays
E-Commerce
Gadgets
Google
Internet
Mobile Phones
Softwares
Technologies
Tutorials
Windows

Pages
About us
Contact us
Privacy Policy

Meta
Log in
Entries RSS
Comments RSS
WordPress.org

2015 Techblogon

http://techblogon.com/android-examples-with-source-code-download/

29/29

S-ar putea să vă placă și