First Android Application
Now time for our first android application. We will start with very basic one and with time we move to the more advanced applications.
Follow the below steps to make your first application
- Open the Eclipse ADT
- File -> New -> Android Application Project
- New Android Application form will appear.
- Fill the form as the picture below and click on Next
Note: Minimum Required SDK – The minimum version of android OS in which the application will run. Target SDK : The latest version of android OS in which the application will run.
- New Android Application – Configure Project window will appear. You can click next as of now, we will talk in detail in further sessions.
- Configure Launcher Icon window will appear, here you will get the opportunity to change your application icon, you can do it later as will, so for now click Next.
- Create Activity Screen will appear, Blank Activity is selected by default, click Next
- Blank Activity will appear, give a name you want to your Activity and to its layout. by default it will be “MainActivity” and “activity_main“. Click Finish
- Your project is created. You can locate your MainActivity java under Hello -> src->com.example.hello->MainActivity.java and the layout file will be Hello -> res -> layout->activity_main.xml.
Run the Application:
- Run the Emulator, Read the article “Emulator” to know how to create a new Emulator.
- Right Click on your project and go to Run As -> An Android Application
- That’s it you have just completed your first android application, Don’t you believe, check out the Emulator.
Say hello with you name in it, (Change the text).
Open the activity_main.xml and look carefully into it.
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" />
now what is this, This is your text, hello word which is appearing on the screen.
Modify a String resource with Name: “hello_world ” and change its Value to “I am Sumit Jain, saying Hello to the android world “ . To know more about , how to modify a string resource, Click here “Strings.xml”
Lets run the application again.
Happy Androiding 🙂
If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.