The part 1 will only define and introduce the fundamental building blocks of Android. Later articles will provide sample code focusing on one aspect at a time, more to drive home to concept than to show any great programming skills.
From a developer's perspective, the fundamental building blocks / components of Android are:
1. Activities
2. Services
3. Broadcast Receivers
4. Content Providers.
The means of communication between the above mentioned components is through
1. Intents
2. Intent Filters
The User Interface elements are by using what are called:
1. Views
2. Notifications
Now, having broadly classified the basics, I would like to give a simple definition for each of them, before we can appreciate the need for each of them.
Activity is the basic building block of every visible android application. It provides the means to render a UI. Every screen in an application is an activity by itself. Though they work together to present an application sequence, each activity is an independent entity.
Service is another building block of android applications which does not provide a UI. It is a program that can run in the background for an indefinite period.
Broadcast Receiver is yet another type of component that can receive and respond to any broadcast announcements.
Content Providers are a separate league of components that expose a specific set of data to applications.
While the understanding and knowledge of these four components is good enough to start development, the knowledge of the means of communication between the components is also essential. The platform designers have introduced a new conpect of communication through intents and intent filters.
Intents are messages that are passed between components. So, is it equivalent to parameters passed to API calls? Yes, it is close to that. However, the fundamental differences between API calls and intents' way of invoking components is
1. API calls are synchronous while intent-based invocation is asynchronous (mostly)
2. API calls are bound at compile time while intent-based calls are run-time bound (mostly)
It is these two differences that take Android platform to a different league.
NOTE: Intents can be made to work exactly like API calls by using what are called explicit intents, which will be explained later. But more often than not, implicit intents are the way to go and that is what is explained here.
One component that wants to invoke another has to only express its' "intent" to do a job. And any other component that exists and has claimed that it can do such a job through "intent-filters", is invoked by the android platform to accomplish the job. This means, both the components are not aware of each other's existence and can still work together to give the desired result for the end-user.
This dotted line connection between components is achieved through the combination of intents, intent-filters and the android platform.
This leads to huge possibilities like:
1. Mix and match or rather plug and play of components at runtime
2. Replacing the inbuilt android applications with custom developed applications
3. Component level reuse within and across applications
4. Service orientation to the most granular level, if I may say
Now that the concept of intent has been introduced, let me get down to a more formal definition of Intent.
Intent is a bundle of information, a passive data structure that holds an abstract description of the operation to be performed. (or in the case of broadcasts, a description of an event that has happened and is being announced).
There are 2 types of intents which I intend to detail in the next part of this series. Before winding up part 1, I would finally also give you a formal definition of Intent filters.
Intent filters are the means through which a component advertizes its own capabilities to handle specific job/operations to the android platform.
Nice tutorial, your all tutorials a re really good, keep the good work going...
ReplyDeleteBookmarked! Thanks!
ReplyDeleteHi, I'm an Admin for a popular Sony Ericsson based forum and blog at www.se-nse.net.
ReplyDeleteCurrently we're looking to expand to cover Android and are looking to invite people with good Android development knowledge to join the forum. Furthermore we would like to develop an Android application for se-nse.net through a community based project.
Your Android tutorials are excellent and I'd like to invite you over to the forum to join our growing community and perhaps become a member of the new "Developers" group who will have a private forum section for software development and of course be able to contribute to the creation of a se-nse.net app for Android.
Please head over to the site and take a look, there's a little more info about the developer recruitment in this topic.
Many thanks and I hope to see you on the forum,
Mik
Hi Sai,
ReplyDeletemy apologies for posting this here but there was no post directly relating to my problem. The problem is described below and I thought you may have some ideas to help me out. Thanks a lot in advance.
When I make a call to the readLine() method of BufferedReader within a thread handler my application hangs up indefinitely. The problem occurs in the line " fromServer = in.readLine();" in bold within the handleMessage() method in the code snippet below. When I remove calls to the Bufferedreader methods the thread executes properly without problems. I could also send the eclipse project file if you wish.
Any help will be appreciated. Thanks very much in advance.
public class TCPClient implements Runnable {
Handler myHandler2 = new Handler(){
public void handleMessage (Message m)
{
switch (m.what)
{
case 2:
try {
fromServer = in.readLine();
if (fromServer.equals("Bye."))
{
try
{
closeAllConnections();
}catch (IOException e){
}
}
if (fromUser != null)
{
out.println(fromUser);
fromUser = null;
}
} catch (IOException e) {
fromServer = "Okokoko";
}
break;
default:
break;
}
super.handleMessage(m);
}
}
};
public void run() {
while (!Thread.currentThread().isInterrupted()){
try{
Thread.sleep(150);
}catch (InterruptedException e){
Thread.currentThread().interrupt();
}
Message m2 = new Message();
m2.what = 2;
myHandler2.sendMessage(m2);
}
}
public static String obtainNewText() {
if (fromServer != null)
{
return fromServer;
}
else return "No Data!";
}
public static void sendNewText(String s) {
fromUser = s;
}
}
Hi Osagie,
ReplyDeleteHas your problem been solved? If not, it would be great if you can share your complete project for me to execute and help you.
-Sai
This comment has been removed by the author.
ReplyDeleteHi Sai,
ReplyDeletethanks a lot for your response. I finally found the reason for the problem. the reason is that the readLine() (in.readline() ) method blocks until a new line is received. All I needed to do was use in.ready() to check if a new line was available before calling readLine().
Regards,
Osagie
Hi Sai Geetha... your tutorials are simply superb and useful. Could you please explain about the IVR system in android and how to implement the IVR in android.please provide the step by step procedure. thanks
ReplyDeleteHi Saravana,
ReplyDeleteThanks for the compliment. :) I did not get your question on IVR. I do not see any native libraries that provide any support for IVR in Android. Can you please elaborate your question?
Your tutorials are really encouraging and helpful to the people who are new to android like me.My sug is please provide sample codes to the basics such that they should be understand by new comers...
ReplyDelete1. IS IVR possible in android ?
ReplyDelete2. If yes means please post the tutorial.
Sai Geetha,
ReplyDeleteThank you for great work. Your tutorials are a great help for android newbie like me.
Hi Sai,
ReplyDeleteReally Nice tutorial. Its very helpful for a beginner like me..
I have a problem. I want to create an application which has a book in epub format with audio to it.
and then want to port this application to fbreaderj.
Can you suggest me how can this be achieved ?
Sorry for posting me problem here..
Thanks in advance..
Hi Sai,
ReplyDeleteI am trying to construct a dice rolling program with the following parameters.
User can choose how many dice they want (1 to 6) and how many faces the die has (1 to 26). I have the view that I want and am trying to implement this using EditText for user input, but have no idea how to grab the input and process it. I'm very new to Android and have a little Java experience. If anyone has a skeleton code or could help it would be greatly appreciated.
Bravo!!!
ReplyDeleteSimple put... excellent as usual...
Nice tutorial...
ReplyDeleteHi Geetha,
ReplyDeletegreat work! Thanks.
How to contact you?
Would you pls kindly approve LinkedIn request?
Thanks & Best regards
kaanthan
Hey, I bought the iPhone version and left a snarky comment for Apple :-). Package it for Android and I'm there on my Nexus One. I love this game.
ReplyDeleteHi Sai,
ReplyDeletemy apologies for posting this here but there was no post directly relating to my problem. I thought you may have some ideas to help me out. Thanks a lot in advance.
I purchased the M002 android tablet(android version 1.6), in that i am able to properly play the full size video using the video view where as when i reduced the video view size then video is not playing properly the same operations i did in emulator it is working properly means video is playing properly in both cases.
Thanks in advance
Please help me to solve my problem.
Hi, Can we use your articles with credits to you? Please approve.
ReplyDeleteHi Admin,
ReplyDeleteWhere do you want to use my articles? In another site? or a printed publication?
nice tutorials.i hope u continuee..
ReplyDeletenice tutorials.i hope u continuee..
ReplyDeleteHi This one is nice tutorial for ours(Beginers)
ReplyDeleteNice tutorial...., All the Best...
ReplyDeleteIs it possible to use one application in another one? if it is, can you give any example with explanation??How to achieve that?
ReplyDeleteHello .. Your tutorials are excellent. Do u have a tutorial on how to make Favorites button in android applications. I am working on a project that needs it and your help would be very useful.
ReplyDeleteHi Sai Geetha,
ReplyDeleteYour posts are really helpful. We are developing android application for our 8th Sem project. We are using your blog as our reference. :)
hi...am swathi..
ReplyDeletereally this is a nice tutorial to know about basics briefly....
good one
thankq
Deleteplease give me your email id
hai can u plz help me?
ReplyDeletei had two packages pkg 1 and pkg2 .
how can i call anctivity in pkg2 from an activity in pkg1?
plz plz help me im really in trouble
Very nice introduction. Thank you very much!
ReplyDeletenice articles :)
ReplyDeletegreat article
ReplyDeleteHi iam Raju
ReplyDeletenice article regarding basics...
Hi
ReplyDeleteI need complete detail of Activities,intents,Intentfilters,android maifest file,calling one event from other event could you please any one can send me a details
manjupradee@gmail.com
Hi Geetha,
ReplyDeleteThak you for your excellent Android blog.
i am a new to android,could you please help in finding good example for accessing internet/webpage data and displaying it on android application.i searched a lot but didnt seen a good one....
Hi
ReplyDeleteSuperb tutorial.
I am newbie to this android.could you please explain the android components with an example and also how service and broadcast receivers are interconnected.
Hi SaiGeetha,
ReplyDeletehope we are doing good,
i am working in mobile based company.
i want to learn android development.please advise me
i have to learn basic level.
please help me like (material,blogs,books)
--Srinivasn
can u just help me out ......
ReplyDeleteI just want to know how to read the album art or cover art of any media file>>
hi sai geetha,
ReplyDeletehope we are doing well.
page views will reaches 200000 today
keep it up.....
ReplyDeleteGood work, thx for your Android blog.
ReplyDeleteI have been following your blog since my early days.I have 1 year and 6 months of experience on Android.All of my experience has been into application development.Recently I have got offers from two companies..One is offering me a profile to work on application layer and other is offering a profile on android middleware.Can you guide me which would be better.Is middleware development better than application layer development from the career perspective in terms of money and other opportunities.
ReplyDeleteThe main thing is that the text which i entered into the edittext is added to the list view .It is added but in some other language not in english what is the problem in this.Please explain
ReplyDeletehello mam,
ReplyDeletei have some problem in my spinner allication .
it doesn.t work with my app.I have tried many times. but there is a
Warning
Tue May 31 11:53:03 IST 2011
AndroidManifest: Ignoring unknown 'string-arrayplanet_array' XML element
?
please help me to overcome this problem .
Hii Geeta,
ReplyDeleteI am a great fan of yours and your articles.
I am an android developer and now i am doing a cricketInfo apps for myself.i am parsing RSS feeds(espn cricket link) and getting a listview which is showing an another url by which i am getting the score card web view.
But my question is "How can i get Individual score of players?" I want to use that particular score and want to give broadcast message in every given time by user..
Please help me.
I will be greatfull to you.
My email id: mnj.behera1@gmail.com
Hi Geeta,
ReplyDeleteI read some of ur articles.Its fentastic.Thank you for providing information in blogs..
I have one small question. Can we convert lower version to higher version.
I developed an Map app in 2.3.1 but it is not working in 2.2 version.can i convert it into 2.2 . how........
please solve my problem........
my email id is sireesh241@gmail.com
Thank you.........
Great Job!! Thanks
ReplyDeleteHi Geeth,
ReplyDeleteone help
how to compare web service date to calendar date in android ?then i want to highlight that date in my calendar...how to achieve this one?give me some idea.. please reply to this mail id iamvijayakumar@gmail.com
Hi,
ReplyDeleteGreat tutorial for android beginners.
Give me some code for database add,edit and delete function.
Thanks,
Alexandar Joseph J
Hi Sai-
ReplyDeleteJust found your site.
Thanks so much for putting this together - it's a great resource!
This tutorial is really helpful for me thanks..........
ReplyDeleteNice article
ReplyDeleteThanks mam
Nice work! keep it up.
ReplyDeletehi..sai geetha gaaru
ReplyDeleteyour tutorials are very superb
nice article
ReplyDeleteHi sai geetha,
ReplyDeleteYour blog is very good and so helpfull,thanks a lot.I need some help regarding device compatibility.That is my application should be compatable on different devices(screens).So, please help in this scenario.
Thanking you,
Nageswarararo.
thanks for providing such a wonderful introduction on android basics.............
ReplyDeletehi geeta ji..i like ur blog most .. ur way of explanation is very good.. i got inspiration from you..and i started my own blog for j2me and android...http://masterkissor.blogspot.com/ ..tnx a lot
ReplyDeletei like this tutorial...........
ReplyDeleteBookmarked this blog. Thanks for sharing your knowledge and experience.
ReplyDeleteVery nice tutorial.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanx a lot!! sai geetha... i want this type of information for Android...such a great Help..
ReplyDeletei found another link for superb tutorials
ReplyDeletehttp://www.jabershabeek.page4.me
visit to study some basics about android
Thanks :)
Deletehi,
ReplyDeletePl anyone give the solution. How to change the image in listview when seleting.
How to change the image when selecting the listview..
ReplyDeleteI think most of the peoples are get good knowledge about android, because its having the useful information. so thanks for creating this interesting blog.
ReplyDeletehai sai...
ReplyDeleteI am new to Android i have a doubt about creating new gallery.. i dont know how move a image from one album to another album
Hi Sai....
ReplyDeleteI am new to Android i have a doubt about drawable.... I am trying to store images in only drawable-hdpi the images are stretching automatically in XML File.....I dot know how to solve this can u help me........Thanks
HI sai,
ReplyDeleteIam new learner in Android idon't know how to create sd card,camera
your site's really great articles.I love android ,too
ReplyDeletei am doijng a zoom application. So i want to add a bar that we normally see in a zooming app. which can be used to zoom in and out. So plz give me some guidelines to add that bar.
ReplyDeletehi.
ReplyDeleteexplain json
Hi Sai,
ReplyDeletePlz explain web services in android..?
Hi This is very useful for me basics for androids. I need a concept of taking images to pdf .and the pdf will be stored images. If any body Plz Help me..
ReplyDeleteThis is one of the awesome and good post..I like your blog tips.thanks for your support.good work.
ReplyDeleteIt's very useful to android beginners
ReplyDeleteI am admin at mobilespecz.net.I love your blog.I came here looking for android tutorials and what you have done here is awesome.Great work madam.
ReplyDeleteNice article.
ReplyDeleteVery helpful....great work mam...
ReplyDeleteI have been a mobile developer for over 7 years on J2ME and Blackberry platforms and now that I wanted to get into Android, I just happen to find this tutorial on the way to find an online guide for beginners.. and I must say, I wouldn't have found a better guide to start with..
ReplyDeleteAbsolutely simplest way to explain the best information on Android for very beginners.
Thanks,
Nanda K.
nice blog
ReplyDeleteBrief and excellent Guide!
ReplyDeletehi Geeta,
ReplyDeleteReally good notes for begginers,,,,, Thanks J.
hi sai geetha i found very good material in this site.. thanks a lot..
DeleteDear Geetha
ReplyDeleteMe frm bngl I jst nw read your article.It's amazing I am rookie in android
and I like to know
Difference between a service and a thread
Excellent article on Android Apps Development, This tutorial is very help full for me.
DeleteRize is providing Android Apps Development services from long time, fell free to contact us at any moment.
ReplyDeleteThank you very much. Bookmarked.
ReplyDeletereally nice tutorial, thanks Geetha.
DeleteI would be supportive on all of your articles and blogs because they are just upto the mark.
ReplyDeleteuseful source
Nice tutorial. Well researched & explained. Thanks for sharing.
ReplyDeleteAndroid Application Development.
Excellent introduction to Android. It is very clear and succinct. Thanks, Geetha.
ReplyDeletepudojava.
Nice tutorial, your all tutorials a re really good, keep the good work going.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletesir,
ReplyDeleteam a beginner and i want to create an app which could take some data and send that data to mysql database in between i used php page to send that data through insert query to mysql, but i dont know why it is not connecting,and if am sending direct data through browser using php page so its working but why not with Android App plz tell me sir i have to complete my major project soon..
Can anyone kindly give some info on how to create mashup by using the camera and android's location services?
ReplyDeleteHi Saigeetha,
ReplyDeleteI am rajasekhar,Hyderabad,
I want to learn android... i dont know any programming languages also,
could you please suggest me how can i learn?
i read 1st chapter from this tutorial some technical words are there...
is it sufficient? or before learning android i have to learn any languages?
Please suggest me...
Thanks
Hi Sai Geetha,
ReplyDeleteNice Introduction to Android Programming. Helped me a lot to understand what is Android Programming all about !!!
Thanks
Hi,Sai Geetha,
ReplyDeleteyour Introduction was good. i want to learn Android .Kindly please help me total notes which useful for learning Android . Iam waiting for your response
Check this quiz that found interesting .
ReplyDeleteAndroid Fundamentals Quiz
Thank you so much sai geetham
ReplyDeleteRecently i've moved to android development i was fully confused by the docs provided by google. Your articles really helping me :)
can you guide me to leran brief about he basics in android
ReplyDeleteHi geetha i want to calculate an speed of the object in the camera recording . how to find can u help.
ReplyDeletegreat tutorial keep doing on
ReplyDeleteSai,
ReplyDeleteI just happened to stumble upon your blog and found to my total surprise found out what I was looking for. A nice tutorial.
Thanks
This comment has been removed by a blog administrator.
ReplyDeleteHai, Your Doing Great, I made fan of your Blog. Can You share Simple Tutorials Related Some Main Android Topics.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete