Hey readers, in this post lets learn how to create our first andriod app which displays 'HELLO WORLD'.
Follow the steps:
- open 'ANDROID STUDIO'
- Start a new android project and give the appropriate names in the fields which will be asked.
- Locate the generated activity file, which in my case is 'ActivityMain.java', and enter the following code,
- onCreate function : This function gets called when your activity is started. Learn more about onCreate in stackoverflow.
- setContentView: This sets the layout for the activity, parameter to be passed is the layout's resource id, something in the form of 'R.layout.name'. Learn more about this here.
4. locate the xml file associated with the activity's java class, which in my case is 'activity_main.xml'. Enter the following code
Notes:
- RelativeLayout: A layout type, learn more here. There are also other type of layouts, check them out here.
- TextView: A view item which displays a text on the layout screen. Learn more here.
Select an emulator and Run on it. [To know how to setup emulator, read this post.
Have a look at our video tutorial for this post on 'CodeShuffle YouTube'
In the next post, lets learn 'How to build a signed apk' of your android project.
Share your views about this article!