Home > Android, Java > beginning android with hello world

beginning android with hello world

In my last post we have talked about how to configure everything to start your android development.
Now in this post i will show you how we can create a very basic “HelloWorld” application for android.
And after that we will be doing some modification on our apps.

so are you ready to go..”yeah!”.but i am not ready.just kidding 🙂

steps:

1:Do i have to tell you that “Open your eclipse”?????? 🙂 i think not
then
you do what i did in my first android tutorial to create an new android project.

2:Ok, now that you’ve created a project run it as android application.

3:There you go…. you should see a virtual device saying “Hello World  (probably your project name)”.

4:Now we want to change something in it.Say… “Hello saiful103a”
So how do we do that
i.go res->values and open strings.xml
ii.Now you should understand where does this “Hello World ..” was coming from
iii.Now you’d think how this sentence is accessed from main file well then open gen->R.java
you should see an inner class called string. In that method what you see compare it with the strings.xml file
then you will understand not everything but enough to start with.
iv.Oh did you change the sentence from hello world to hello saiful103a.
v.Now run it….. voila….

is it worked ????yes then we should take a coffee break …..:)

5:Now we want our text to be red
create a file named colors.xml into res->values folder
inside that paste the below code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorOfText">#ff0000</color>
</resources>

6.Open main.xml you should see a TextView element this element decide how the text will appear
on the screen upon it’s given attribute.
since we want to change color of the text add an extra attribute
->android:textColor="@color/colorOfText"
after that textview should be seen like:
<TextView
android:textColor="@color/colorOfText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

save it….
run it……….
voila…………..

so isn’t that (i will not say awesome cz we do not yet explored it deep enough but we will be) goooooood..:)

but that’s it for today…

So .. “HAVE A GOOD PROGRAMMING”

Advertisements
Categories: Android, Java
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: