A Way To Create An Android App With Android Studio

Introduction: How to Create an Android App With Android Studio

This academic will teach you the basics of how to build an Android app the usage of the Android Studio development environment. As Android devices grow to be increasingly commonplace, call for for brand new apps will handiest boom. Android Studio is an clean to use (and unfastened) development environment to learn on. It’s nice if one has a running understanding of the Java programming language for this tutorial due to the fact it’s far the language utilized by Android. There might not be plenty code used in this tutorial, so I will anticipate that you realize sufficient Java to recognize or are inclined to appearance up what you do not know. This will take roughly 30-60 mins, relying on how speedy you are able to down load and installation Android Studio. After the usage of this academic to create your first Android app, you’ll be nicely for your way to a fun new interest or likely even a promising career in cell development.

Step 1: Install Android StudioGo to http://developer.android.com/sdk/index.htmlto down load Android Studio. Use the installer to install Android Studio following its instructions.Step 2: Open a New ProjectOpen Android Studio.Under the “Quick Start” menu, select “Start a new Android Studio assignment.”On the “Create New Project” window that opens, call your challenge “HelloWorld”.If you pick to, set the company call as favored*.Note wherein the task report location is and trade it if desired.Click “Next.” Make certain on that “Phone and Tablet” is the simplest field that is checked.If you’re planning to test the app to your telephone, make sure the minimum SDK is beneath your cellphone’s running system stage.Click “Next.” Select “Blank Activity.”Click “Next.” Leave all of the Activity call fields as they may be. Click “Finish.”

*Note: It is standard naming convention in Android tasks to set the business enterprise call as some shape of “example.call.here.com”.

Step three: Edit the Welcome Message inside the Main ActivityNavigate to the activity_main.xml tab if it isn’t already open. Make positive that the Design tab is open on the activity_main.xml show. Click and drag the “Hello, global!” from the top left nook of the phone display to the center of the display. In the task file device on the left aspect of the window, open the values folder. In the values folder, double-click the strings.xml report. In this document, find the line “Hello world!”. After the “Hello world!” message, add “Welcome to my app!” Navigate lower back to the activity_main.xml tab. Make certain that your centered textual content now reads “Hello global! Welcome to my app!”Step 4: Add a Button to the Main ActivityNavigate to the Design tab of the activity_main.xml show. In the Palette menu to the left of the smartphone show, locate Button (beneath the heading Widgets). Click and drag Button to be targeted under your welcome message. Make positive your button remains decided on. In the Properties menu (on the right facet of the window), scroll right down to locate the sector for “text.” Change the textual content from “New Button” to “Next Page.”Step 5: Create a Second ActivityAt the top of the venture’s report device tree, proper click on on “app.”Navigate through to New > Activity > Blank Activity.Change the call of this activity to “SecondActivity”.Click “Finish.”Make positive you are inside the Design view of activity_second.xml.Drag the text field inside the top left of the cellphone display right down to the center as you probably did on the Main Activity.With the textual content container nonetheless decided on, discover the “id” area within the Properties menu at the proper, and set it to “text2”.Open strings.xml again.Add a new line under “Hello world! Welcome to my app!” that reads “Welcome to the second page!”.Navigate back to activity_second.xml.Select the textual content box once more.In the Properties pane, set the “textual content” subject to “@string/second_page”.Make positive that the text box now reads “Welcome to the second web page!” and is within the center of the display screen inside the smartphone show.Step 6: Write the Button’s “onClick” MethodSelect the MainActivity.java tab along the top of the paintings surroundings.

2.Add the following traces of code on the quit of the onCreate approach:

Button button = (Button) findViewById(R.identification.button);

button.setOnClickListener(new View.onClickListener()

@Override

public void onClick(View v)

goToSecondActivity();

);

three.Add the subsequent approach to the bottom of the MainActivity class:

private void goToSecondActivity()

Intent cause = new Intent(this, SecondActivity.class);

startActivity(intent);

four.Click the + subsequent to import at the third line of MainActivity.java to amplify the import statements.

5.Add the subsequent to the cease of the import statements if they may be no longer already there:

import android.content.Intent;

import android.view.View;

import android.widget.TextView;

Step 7: Test the ApplicationClick the green play symbol from the toolbar at the pinnacle of the Android Studio window.When the “Choose Device” dialog apperas (this may take a few moments), select the “Lauch emulator” option.Click OK.When the emulator opens (this too ought to take awhile), the app will automatically launch the app upon the digital cellphone being unlocked.Make certain that all of your text shows efficiently and that the button takes you to the next web page.Step 8: Up, Up, and Away!

Congrats! You’ve now finished your first Android application with some primary functionality. Your finished app need to have a page greeting the consumer and a button that takes the consumer to a second page.

From right here you’ve got the cursory information you need to go directly to analyze all there may be to know approximately Android software improvement.

20 People Made This Project!Recommendations

Leave a Reply

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