How to Create an Android Application?

0
103
How to Create an Android Application

How to Create an Android Application?

This instructional exercise will show you the nuts and bolts of how to construct an Android app utilizing the Android Studio advancement condition. As Android gadgets turn out to be progressively more typical, interest for new apps will just increment. Android Studio is a simple to utilize (and free) improvement condition to learn on. It’s ideal on the off chance that one has a working information of the Java programming dialect for this instructional exercise since it is the dialect utilized by Android. There won’t be much code utilized in this instructional exercise, so I will accept that you know enough Java to comprehend or will look into what you don’t have a clue. This will take around 30-hour, contingent upon how rapidly you can download and introduce Android Studio.

Also Read: Things to Know Before Starting Mobile Web App Development

What will you comprehend?

Step by step instructions to utilize Android Studio to assemble your app.

Step by step instructions to run your app on a gadget or in the emulator.

Step by step instructions to include intuitive catches.

Step by step instructions to show the second screen.

What must you be acquainted with already?

This code is composed for software engineers and expects you know Java. On the off chance that you are an accomplished developer and you are proficient at perusing code, you will probably have the capacity to take after this code regardless of whether you don’t have much involvement with Java.

You compose Android apps in Java utilizing an IDE called Android Studio. In light of JetBrains‘ IntelliJ IDEA programming, Android Studio is an IDE composed particularly for Android improvement.

To work through this code, you will require a PC that can run Android Studio (or as of now has Android Studio introduced).

Step 1: Install Android Studio.

  1. Download Android Studio here: https://developer.android.com/studio/
  2. Acknowledge the default configurations for all means.
  3. Ensure that all components are chosen for the establishment.

How to Create an Android Application

4. In the wake of completing the install, the Setup Wizard downloads and introduces extra components. Be persistent, in light of the fact that this may take some time contingent upon your Internet speed, and a portion of the operations may appear to be excess.

5. At the point when the download finishes, Android Studio begins, and you are prepared to create your first task.

Step 2: Create a new project.

  1. Open Android Studio.

How to Create an Android Application

 

  1. In the fundamental Welcome to Android Studio exchange, click Start another Android Studio venture.
  2. In the New Project discourse, give your application a name, for example, My First App.
  3. Acknowledge the default illustration space.

How to Create an Android Application

  1. Acknowledge the default project location. Hit Next.
  2. In the Target Android Devices domain, acknowledge the defaults. Click Next.
  3. Select Empty Activity. Hit Next.
  4. In the Customize the Activity exchange, acknowledge the defaults.

How to Create an Android Application

  1. Click Finish.

Step 3: Presently pause for a minute to survey the most essential files

Initially, make sure the Project window is open (select View > Tool Windows > Project) and the Android see is chosen starting from the drop list at the highest point of that window. You would then be able to see the accompanying files:

app> java >com.example.myfirstapp>MainActivity

This is the principle action (the passage point for your app). When you create and run the app, the framework dispatches an example of this Activity and burdens its format.

How to Create an Android Application

app> res > design > activity_main.xml

This XML record characterizes the design for the action’s UI. It contains a TextView component with the content “Hi world!”.

app> shows > AndroidManifest.xml

The show record depicts the basic attributes of the app and characterizes every one of its parts.

Gradle Scripts >build.gradle

How to Create an Android Application

You’ll see two records with this name: one for the task and one for the “app” module. Every module has its own particular build.gradle record, yet this task at present has only one module. You’ll for the most part work with the module’s build.gradle record to design how the Gradle tools order and create your app.

Also Read: Things to do for making IOS Mobile App Successful

Step 4: Edit the Welcome Message in the MainActivity.

  1. Explore to the activity_main.xml tab on the off chance that it isn’t as of now open.
  2. Ensure that the Design tab is open on the activity_main.xml show.
  3. Click and drag the “Welcome, world!” from the upper left corner of the phone show to the focal point of the screen.
  4. In the project file system on the left half of the window, open the values folder.
  5. In the values folder, double tap the strings.xml record.

How to Create an Android Application

  1. In this file, discover the line “Hi world!”.
  2. After the “Welcome world!” message, include “Welcome to my app!”
  3. Explore back to the activity_main.xml tab.
  4. Ensure that your focused content presently peruses “Hi world! Welcome to my app!”

Step 5. Insert a Button to the MainActivty.

  1. Explore to the Design tab of the activity_main.xml show.
  2. In the Palette menu to one side of the phone show, discover Button (under the heading Widgets).
  3. Click and drag Button to be focused underneath your appreciated message.

How to Create an Android Application

  1. Ensure your button is as yet chosen.
  2. In the Properties menu (on the correct side of the window), look down to discover the field for “content.”
  3. Change the content from “New Button” to “Next Page.”

Step 6. Create another Activity(screen) now.

  1. At the highest point of the project file system hierarchy, right tap on “app.”
  2. Explore through to New > Activity > Blank Activity.
  3. Change the name of this activity to “SecondActivity”.
  4. Hit “Finish.”

How to Create an Android Application

  1. Ensure you are in the Design view of activity_second.xml.
  2. Drag the content box in the upper left of the phone show down to the middle as you did on the Main Activity.
  3. With the text box still chosen, discover the “id” field in the Properties menu on the right, and set it to “text2”.
  4. Open strings.xml once more.

How to Create an Android Application

  1. Include another line under “Hi world! Welcome to my app!” that peruses “Welcome to the second page!”.
  2. Explore back to activity_second.xml.
  3. Select the text box once more.
  4. In the Properties sheet, set the “content” field to “@string/second_page”.
  5. Ensure that the text box presently peruses “Welcome to the second page!” and is in the focal point of the screen in the phone display.

Step 7. Code for post activity of Button Click method.

  1. Select the MainActivity.java tab at the top of the work environment.
  2. Include the accompanying lines of code toward the finish of the onCreate method:

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

button.setOnClickListener(new View.onClickListener() {

@Override

public void onClick(View v) {

goToSecondActivity();

}

});

  1. Add the accompanying function to the end of the MainActivity class:

private void goToSecondActivity() {

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

startActivity(intent);

}

  1. Tap the + next for importing at the third line of MainActivity.java to extend the import statements.

 

  1. Add the following to the finish of the import expressions  that they are not as of now there:

importandroid.content.Intent;

importandroid.view.View;

importandroid.widget.TextView;

Step 8: Run your application.

  1. Run on an emulator:

(i) Open the Android Studio to click the app module present in the Project Window and further select Run> Run (or click Run  in the toolbar).

(ii) Hit Create New Virtual Device in the Select Deployment Target window.

(iii) You can now select a phone device of your choice in the Select Hardware screen.

(iv) In the System Image window, select the version with the highest API level. If the version required is absent, complete the download.

(v) Click Next.

(vi) You will be directed to the AVD(Android Virtual Device ) screen, just do not make any change to the settings, press Finish.

(vii) Revert to Select Deployment Target dialog, select the device you just created and click OK.

How to Create an Android Application How to Create an Android Application

Android Studio introduces the application on the emulator and begins it. You should now observe “Hi World!” showed in the application running on the emulator.

Ensure that the majority of your content shows effectively and that the button takes you to the following page.

Well done! You’ve now finished your first Android application with some essential usefulness. Your completed application ought to have a page welcoming the client and a catch that takes the client to a second page.

From here you have the careless information you have to proceed to take in everything to think about Android application improvement.

Also Read: The Best Web Development Technologies to Learn in 2018

Disclaimer:- All The IMAGES/PICTURES shown in the article belongs to the respected owners and not me. I am not the owner of Image showed in the article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here