Hello Android Studio

I have installed Android Studio, and I have made a Nexus 7 ready to be used as target device. Now I am ready to develop a first "Hello world" application.

Android Studio make it very easy.

Just select New Project from the file menu (or from the welcome dialog) and specified which properties you want to change from the default schema. I modified just three of them:
- Application name: Hello Android
- Module name: HelloAndroid
- Package name: dd.HelloAndroid
Then was just a matter of compiling and, after ensuring the target device was connected and available to my developer unit, ran it.

After confirming on Nexus that I wanted to debug that app, I saw it appearing. It doesn't say much. It just have the "Hello Android" name on the title bar and, wait a moment, an "Hello world!" message below it? Where does it come from?

We should remember that among the properties we were asked to confirm to create a new project, there was also something about the layout to be used by the application. Let's check it.

I opened the Project View, I clicked on my HelloAndroid project, src, main, res, layout, and I finally see it, activity_main.xml.

In it I see that the TextView property is filled with an @string/hello_world. So I opened the res, values, strings.xml, and I saw that a hello_world string resource was set for me to the value "Hello world!"

I don't want any message on my app, so I cut that line, went back to activity_main.xml, and remove from the "text" property the reference to that string. Re-launching HelloAndroid I can now enjoy its beautiful emptiness.

1 comment:

  1. X-Byte Enterprise Solution is a leading blockchain, AI, & IoT Solution company in USA and UAE, We have expert Web & mobile app development services

    Know more here: https://www.xbytesolutions.com/

    ReplyDelete