Create Your First "Hello World" Android App



Create your own Hello World Android App

Aah, the classic "Hello World" phrase that has been the birth the of many a programs, and indeed, programmers. To learn a new language, and to start programming in that language, you first have to create the most basic program, that is, the "Hello World" program. So continuing our Android App Development series, we figured it would be a good idea to do a small tutorial on how to create your first "Hello World" Android app. We all use, and love certain Android apps. But wouldn't it be cooler to make your own Android apps? It is, afterall, a great way to earn money!
The Android app store is growing at a rapid rate since its start. Apps is the reason why this OS is so popular. With over several hundred thousands apps, Android is one of the main players in this industry. Android app development is however a side many of us never cared or dared to approach due to its seemingly complex nature.. With the SDKs available, Android app development is not at all a hassle - rather, it's something really interesting the programmers out there. So, allow us to walk you through all the steps in creating your first Android app. You can still learn even if you're not a programmer.

Here's our Android series so far. Make sure you have set up the SDK (Part 1) before moving on wih this tutorial.

Part 2: Create Your First "Hello World" Android App
Part 3: In progress

Step 1: Setting up a new project

We have already talked about obtaining the SDK for Android Development. Now from the SDK folder, open up the eclipse.exe file, and create a new Android Application Project from the File menu.

Create new Android project

Step 2: Project Settings

The next step is to configure your new project. Give your Application and Project a name and keep the Package name as it is. The settings shown below them need to be set carefully or your application will not work properly.

Project Settings

The Minimum Required SDK should be set to Android 2.3 (Gingerbread) unless, of course, you are specifically designing an app for an older OS. The Target SDK and Compile With option should be set to the latest API present, Android 4.2 in our case. As for the Theme, set it to your will.

Click on Next and you’ll come up with the app logo design, do it as you please and again go on the next page. There it would ask you about the layout of the main activity, set it to BlankActivity. Click Finish on the last window.

Step 3: Select test device

After the configurations, the actual app development begins. You can see the layout of your app in the centre of the screen. Start by selecting the target device by clicking on the small downward arrow beside the Nexus One text located on the bar right above the layout. You can select any sized device you desire.

Select Test Device

Step 4: Adding a widget

The layout of your app would be pretty much blank right now. On the left would be a Palette tab from where you can drag and drop various objects and widgets onto the screen directly. Start by dragging the TextView onto the screen.

adding an object

Step 5: Say "Hello World"!

The right most tab would be the Outline tab. Near its bottom would appear the textview’s settings after you select it from the app layout screen by left-clicking once on it. Change the third option labelled Text from 'TextView' to 'Hello World'. Ignore the warnings for now.

Say Hello World

Step 6: Testing your app

And that’s it! Your app’s ready. Easy huh? Hello World’s are always easy. Now let’s run it on an emulator. We discussed all about Android Virtual Devices (AVDs) in the previous post). For running it on your android smartphone, go directly to Step 8.

Now from the Package Explorer tab on the left of the screen, right click on your project folder, navigate to Run As and click on Android Application.

Test Your App

In the previous post, we saw how to create a virtual device. If you missed that, then you can always create a new one. Select Launch a new android virtual device and then click on Manage. Click on New and set the various attributes of your emulator. Make sure the RAM and the Internal Storage are at least 512MB.

Setting up AVD

Click on OK and close the dialogue boxes.

Step 7: Choose AVD

Reopen the Android Device Chooser and now select your new AVD and click on OK. The emulator will open up and your app will automatically load up. If it doesn't, click on the Apps icon and select your app from there. You might have to wait a bit for the app to show up.

Run on Emulator

Step 8: Run on a real device!

In order to run the App on your phone, you need the .apk file which can be obtained from the bin directory in your project folder. In our case, it is at \workspace\HelloWorld\bin\HelloWorld.apk. Copy that .apk file to your Android smartphone and install from there.

Congratulations! Your Hello World Android App development process has finally been completed successfully (I hope). With a little programming knowledge, you can actually create decent apps pretty easily using this SDK. So what would be your next Android app project? Let us know in the comments section. Cheers :)

Need Quick Help within 24 Hours? ASK NOW



If you don't want to get yourself into Serious Technical Trouble while editing your Blog Template then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your order details by Clicking Here »

32 comments : Post Yours! Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with 'Links' will be deleted immediately upon our review.

  1. Its Amazing Qasim bro...I always like programming in C++, Java but Android is one of my finest because of Google product...Thanks for creating the first "Hello World" program.

    Thumbing to MBT.

    ReplyDelete
  2. I have followed till what was written though i didn't exactly understood what .apk files were..But great tutorial though..I'm also trying it with another app engine that would enable me to add thing with less manual effort

    SUGGESTION TO MAKE BLOGGER THE BEST

    ReplyDelete
  3. I have also tried it the day before Yesterday... :-) Nice post Qasim. My friend Shoaib Aslam has also used it in March 2012 as its final project. SDK is really an amazing toolkit for android development.

    ReplyDelete
    Replies
    1. Yes, Eclipse is a really powerful tool

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Very Nice Post Bro on the Android Subject. Keep it up. Again Thanks for Blogger Tutorial, Tips and Tricks

    Regards,
    http://www.trickshut.com/

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. On step 6 when I try to run test application it give error that


    [2013-09-04 06:37:56 - SDK Manager] Created AVD 'testdevice' based on Android 4.3, ARM (armeabi-v7a) processor,
    [2013-09-04 06:37:56 - SDK Manager] with the following hardware config:
    [2013-09-04 06:37:56 - SDK Manager] hw.sdCard=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.device.manufacturer=Google
    [2013-09-04 06:37:56 - SDK Manager] hw.mainKeys=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.lcd.density=240
    [2013-09-04 06:37:56 - SDK Manager] hw.accelerometer=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.dPad=no
    [2013-09-04 06:37:56 - SDK Manager] hw.device.hash=499058361
    [2013-09-04 06:37:56 - SDK Manager] hw.trackBall=no
    [2013-09-04 06:37:56 - SDK Manager] hw.device.name=Nexus S
    [2013-09-04 06:37:56 - SDK Manager] hw.camera.back=none
    [2013-09-04 06:37:56 - SDK Manager] hw.sensors.proximity=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.battery=no
    [2013-09-04 06:37:56 - SDK Manager] disk.dataPartition.size=1000M
    [2013-09-04 06:37:56 - SDK Manager] hw.audioInput=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.sensors.orientation=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.camera.front=none
    [2013-09-04 06:37:56 - SDK Manager] hw.gps=yes
    [2013-09-04 06:37:56 - SDK Manager] skin.dynamic=yes
    [2013-09-04 06:37:56 - SDK Manager] hw.keyboard=yes
    [2013-09-04 06:37:56 - SDK Manager] vm.heapSize=32
    [2013-09-04 06:37:56 - SDK Manager] hw.ramSize=1000
    [2013-09-04 06:41:16 - helloworld] ------------------------------
    [2013-09-04 06:41:16 - helloworld] Android Launch!
    [2013-09-04 06:41:16 - helloworld] adb is running normally.
    [2013-09-04 06:41:16 - helloworld] Performing com.example.helloworld.MainActivity activity launch
    [2013-09-04 06:41:16 - helloworld] Automatic Target Mode: launching new emulator with compatible AVD 'testdevice'
    [2013-09-04 06:41:16 - helloworld] Launching a new emulator with Virtual Device 'testdevice'
    [2013-09-04 06:41:16 - Emulator] Warning: No DNS servers found
    [2013-09-04 06:41:16 - Emulator] Failed to allocate memory: 8
    [2013-09-04 06:41:16 - Emulator]
    [2013-09-04 06:41:16 - Emulator] This application has requested the Runtime to terminate it in an unusual way.
    [2013-09-04 06:41:16 - Emulator] Please contact the application's support team for more information.
    [2013-09-04 06:44:12 - helloworld] ------------------------------
    [2013-09-04 06:44:12 - helloworld] Android Launch!
    [2013-09-04 06:44:12 - helloworld] adb is running normally.
    [2013-09-04 06:44:12 - helloworld] Performing com.example.helloworld.MainActivity activity launch
    [2013-09-04 06:44:12 - helloworld] Automatic Target Mode: launching new emulator with compatible AVD 'testdevice'
    [2013-09-04 06:44:12 - helloworld] Launching a new emulator with Virtual Device 'testdevice'
    [2013-09-04 06:44:12 - Emulator] Warning: No DNS servers found
    [2013-09-04 06:44:12 - Emulator] Failed to allocate memory: 8
    [2013-09-04 06:44:12 - Emulator]
    [2013-09-04 06:44:12 - Emulator] This application has requested the Runtime to terminate it in an unusual way.
    [2013-09-04 06:44:12 - Emulator] Please contact the application's support team for more information.


    Also there is no .APK file in helloworld folder. How to save .APK?

    ReplyDelete
    Replies
    1. ok brother, although there is an apk file in the bin directory, but if you are unable to locate it dont worry. There's an alternate and quite easy way of making apk of your project..
      Just follow these steps and it should do:
      1. right-click on your project in the solution explorer, there you'll find an option named "EXPORT".
      2. Click export, a dialog will appear, select executable apk and hit NEXT
      3. It will then ask you for a debug keystroke, if you already have one, browse it and enter the location, if you dont, then click "create new debug keystroke"
      4. just fill in the required fields, like author name, password, alias and certificate expiry and it will generate a keystroke for you. When you are done with this, hit NEXT.
      5. Now browse for your destination folder (folder where you wish to store the apk file) and you are done..

      .. hope that was helpful for you.

      Hussain :)

      Delete
    2. Your code seems like your project is somewhere trying to connect to a service which hasn't been declared in you manifest.xml
      Please make sure whatever service you are using which involves explicit invoking, you also define permission for it in your manifest file..
      Hopefully, that should fix your problem.

      Delete
  8. I have been learning C++ still and only now how to create Hello World! :-D

    Now after reading your post I will try to create Hello World In Android too :)

    Hope that I may go ahead in this in comparision to C++

    Show your kindness by visting
    TrackMyBloG

    ReplyDelete
    Replies
    1. Same to Me Surya Kant.........thanks

      Delete
  9. Hallo Qasim Brother
    Sumit from India, Good Idea again. But i suggest that you should start a new site for android or any other platform tutorials. It gain more users for your STC Network. & I also want to join your network.

    ReplyDelete
  10. See This Blog For Downloading Latest PC Games For Free,Full Working With Crack-->
    Pcgameloverzz.:The Pro Gaming::A Gaming Jackpot

    ReplyDelete
  11. Wow Great to see this post here, Will Use in My Website

    ReplyDelete
  12. you should give the video Demo of this..

    ReplyDelete
  13. Hey guys If you are looking for the best android apps , software and games for free then you can get all kinds of exciting and useful apps on : http://www.freedownloadappsforpc.com , so enjoy playing android games and get all kinds of android apps for free. Visit the site once guys, really very useful for you guys

    ReplyDelete
  14. Well The Post is all awesomee , thikin' to Use in Music Blog And MusicLinda

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Hi, Thanks for sharing the guide and approach to create my first program, that is the hello world Android app. Is Eclipse or Netbeans better as Android IDE?

    Thanks,
    Techlurk.com

    ReplyDelete
  17. A Lovely Post ! thanks for sharin' it ! goin' to use this on my blogs MusicLinda , MusicBlog

    ReplyDelete
  18. nyc article

    check out my website www.usamahassan.com

    ReplyDelete
  19. awesome post. Thank you
    http://www.blogolect.blogspot.com

    ReplyDelete
  20. I really enjoyed the quality information you offer to your visitors from this blog. Thanks for sharing such an useful tips for android beginners...

    ReplyDelete