Difference between revisions of "Android Studio"

From Grundy
Jump to navigation Jump to search
Line 62: Line 62:
 
:*A Java File(Main Activity.Java)
 
:*A Java File(Main Activity.Java)
 
:*An XML File(activty_main.Xml)
 
:*An XML File(activty_main.Xml)
 +
 +
 +
[[File:Android2.png|center|600px|caption|link=]]
 +
 +
Java File is where you work on the Backend Part.
 +
:Here, you write codes and methods for every single feature.
 +
 +
XML File is basically the Frontend Part.
 +
You have two options:
 +
:Either you can add features manually by writing codes.
 +
"Alternatively you can drag and drop features and change their attributes.
 +
 +
==Let us build our first app: A CALCULATOR==
 +
 +
Building the interface:
 +
 +
Here is the  XML File:(Refer to picture below)
 +
 +
:*The yellow circle- The option gives you a choice to view your design and/or your blueprint.
 +
A blueprint is basically the wireframe of your design.
 +
 +
:*The purple rectangle- This is the section from where you can switch to design and/or text of an XML file. As mentioned, you can either add features by writing codes or drag and drop. For writing codes, we use the text section and for drag/drop, the design section.
 +
 +
:*The red Palette- List of options from which you can pick up features
 +
 +
:*The green rhombus: Attributes corresponding to each feature will be displayed here.
 +
 +
[[File:Android_5.png|center|600px|caption|link=]]

Revision as of 19:58, 17 May 2020

Android studio is a framework that includes every tool necessary to develop Android apps and games. Technically, it is an official IDE (Integrated Development Environment) for facilitating app and game development

Let us begin this journey of developing Apps and Games:

Downloading Android Studio

Download latest version of Android Studio Here

Starting A Project

  • File→ New→ New Project
caption

Choose an activity as desired. For beginners, let us start by creating an empty activity. Next, you assign a name to your application, and choose a language. Generally, codes are written in two languages: Java and Kotlin. You can choose any of the two. For this tutorial we will follow Java.

Minimum SDK: Here is where you decide to make a trade off. Choosing the version of API vs the target devices.

Well,

  • API 16(Jelly Bean): Supported by 99.8% devices
  • And API 26(Oreo): Supported by 60.8%devices

If you use older versions,your app may miss out on many of the “modern” features and If you use the latest versions , as you might have guessed, your app will not be supported by many devices.

Personally, I recommend using an API 23 version but of course it totally depends on what tasks you want your apps to perform.

And Finally The Finish Option. Your Project is Loaded.

caption

This is what the screen looks like(For an empty Activity)

Creating a Virtual Device

Well, once you start working on a project, you would want to run your app on every step. Android Studio has its built in Emulator wherein you can create virtual devices and run your apps on them. Alternatively, you can use external emulators like Genymotion Download Genymotion. Also you can connect your own device and run your apps using the Developer Mode. Read about this here

Here is how you can create a virtual device using Android In-Built Emulator:

  • Launch AVD Manager(An Option on the Upper Right Corner)

A window similar to this will Pop Up. I have already created a virtual device, yours might be empty.

  • Go to the option-” Create Virtual Device”
caption


caption
Select a suitable device→ Next → Check your API level → Next → Name your Device→ Finish.

Your Virtual Device is All Set.

Working On the Project

When you create an activity, you see two files on the screen-

  • A Java File(Main Activity.Java)
  • An XML File(activty_main.Xml)


caption

Java File is where you work on the Backend Part.

Here, you write codes and methods for every single feature.

XML File is basically the Frontend Part. You have two options:

Either you can add features manually by writing codes.

"Alternatively you can drag and drop features and change their attributes.

Let us build our first app: A CALCULATOR

Building the interface:

Here is the XML File:(Refer to picture below)

  • The yellow circle- The option gives you a choice to view your design and/or your blueprint.

A blueprint is basically the wireframe of your design.

  • The purple rectangle- This is the section from where you can switch to design and/or text of an XML file. As mentioned, you can either add features by writing codes or drag and drop. For writing codes, we use the text section and for drag/drop, the design section.
  • The red Palette- List of options from which you can pick up features
  • The green rhombus: Attributes corresponding to each feature will be displayed here.
caption