Android Hello world example using Android Studio

In previous post, we have setup android studio and SDK. In this post, we will create Android hello world app.
Once you are done with Android studio download and installation, you will see below screen.

Start new Android project

Click on “Start a new Android studio project”. You will see below screen.

Create New Android Project

Application Name : You need to provide name of application.
Company Domain : If you have your domain, you can put it here.
Package name : Package name should be unique. When you publish your application with google play store, google play store distinguishes your app by package name only.

Click on Next after filling above form.

Choose Phone and tablet

Choose “Phone and Tablet” and select Minimum SDK, you want to support for your application.
Click on Next and you will see below screen:

Choose Android Activity

It is activity selection screen. We will choose “Empty Activity”. It should be good enough for our hello world project.
Click on Next.

Customize Activity

Activity Name : It is name of Activity , you want to create. I have put it as “HelloWorldActivity”.
Layout Name : When Android studio create activity for you, it also create layout xml file which binds with the activity.
Don’t worry , if you do not understand about it much, I will write separate post to explain Activity.
Click on Finish. You will get below screen.

Created Android Hello world

Run Hello World App :

Lets run the app now.
Go to Run – > Run ‘app’ , you will see below screen.

Select AVD screen

We are going to create Android Virtual Device to demonstrate create android app.
Click on “Create New Virtual Device” , you will see below screen.

Choose Android Hardware

Choose suitable android configuration on which you are going to test your application. Click on next.

Download System Image

Here we are going to select System image, you may not have downloaded system image, so you can download by clicking on link.
When you click on download, you will see below screen.

Download Android Virtual Device

It will download system image, once done click on Finish. You will see below screen.

Android Virtual Device

You can provide name to your AVD. Click on Finish.

Nexus 5 API 25

Choose downloaded AVD and click on Ok.
You will see an additional app started.

Android Hello World Screen

Bingo!! we have successfully create Hello world Android App. Don’t worry if you do not understand much yet, I will explain about Activity and Android folder structure which will help you to understand created android app.

Related Posts

  • Fill array with random numbers c++
    19 January

    Fill Array With Random Numbers in C++

    Table of ContentsThe rand() Function in C++How to Fill the Array With Random Numbers in C++?How to Fill the Array With Random Numbers in a Range in C++?Conclusion IN this post, we will see how to fill array with random number in C++. Arrays are the most commonly used data structures in the programming domain. […]

  • Python copy file to another directory
    17 January

    How to copy file to another directory in Python

    Table of ContentsWays to copy file to another directoy in PythonUsing file handlingUsing the shutil libraryUsing the pathlib libraryUsing the os moduleUsing the subprocess moduleConclusion In this article, we will see different ways to copy file to another directory in Python. We can read and write files in Python. We can also work with paths […]

  • Instagram Music Search Not Working
    17 January

    Instagram Music Search Not Working – 8 Easy Fixes

    Table of ContentsReasons Behind Instagram Music Search Not Working.Fix Instagram Music Search Not Working.1. Update The Application.2. Switch Back To Personal Account.3. Clear Cache & Storage Data.4. Reinstall Instagram.5. Use Instagram Lite.6. Use A VPN Connection.7. Use DownDetector.8. Reach Out To Instagram Support Center.Frequently Asked Questions (FAQs):1. How do you add music to Instagram Stories?2. […]

  • Convert ASCII to char in C++
    15 January

    Convert ASCII to Char in C++

    Table of ContentsHow to Convert ASCII values to Char in C++?Convert ASCII to Char in C++ Using Char() FunctionConvert ASCII to Char in C++ Using C-Style CastConvert ASCII to Char in C++ Using the Assignment OperatorConvert ASCII to Character in C++ Using sprintf() FunctionConclusion The characters are represented using integers in most of the encoding […]

  • Split String by pipe in java
    15 January

    Split String by pipe(|) in java

    Table of ContentsHow to split String by pipe in javaUsing split() methodUsing StringTokenizerUsing Pattern class In this post, we will see how to split String by pipe in java. How to split String by pipe in java There are multiple ways to split String by pipe (|) in Java. Using split() method You can use […]

  • In this post, we will see how to generate random number between 1 to 10 in javascript. How to generate random number between 1 and 10 in javascript We can simply Math.random() method to generate random number between 1 and 10 in javascript. `Math.random()` returns a random number between 0(inclusive), and 1(exclusive). That means `Math.random()` returns always number lower than 1. We can use `Math.random()` with `Math.floor()` to generate random integer. Here is generic formula to generate random number in the range. Math.floor(Math.random() * (maximum - minimum + 1)) + minimum In our case, minimum = 1 maximum = 10 so it will be Math.floor(Math.random() * (10 - 1 + 1)) + 1 Math.floor(Math.random() * 10) + 1 So here is the program to generate random number between 1 and 10 in javascript. var randNum = Math.floor(Math.random() * 10) + 1; console.log(randNum) When you run above program, you will get below output: 3 You can obviously get differnt outout as we are generating random number here. Generate 10 random integers in range of 1 to 10 console.log("Generating 10 random integers in range of 1 to 10") for (let i = 0; i < 10; i++) { var randNum = Math.floor(Math.random() * 10) + 1; console.log(randNum) } Generate 10 random integers in range of 1 to 10 7 5 1 10 5 9 7 7 6 2 Generate random number in a range in javascript Here is generic formula to generate random number in a range. function generateRandomInteger(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // Generate random number between 1 to 10 console.log(generateRandomInteger(1,10)) // Generate random number between 11 to 20 console.log(generateRandomInteger(11,20)) // Generate random number between 21 to 30 console.log(generateRandomInteger(21,30)) 4 17 28 In case, if you don't want to include maximum while generating random numbers, you can use below function. function generateRandomInteger(min, max) { return Math.floor(Math.random() * (max - min)) + min; } That's all about how to generate random number between 1 and 10 in javascript
    15 January

    Generate random number between 1 and 10 in javascript

    Table of ContentsHow to generate random number between 1 and 10 in javascriptGenerate 10 random integers in range of 1 to 10Generate random number in a range in javascript In this post, we will see how to generate random number between 1 to 10 in javascript. How to generate random number between 1 and 10 […]

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.