Android is most used Mobile OS
worldwide. making an android app is not as difficult as one think of. You just need to have minor knowledge about android structure and little java programming. How do you make an Android app?
Do you have any of below questions?
- How to create android apps for beginners?
- How to create an android app with few lines of coding?
- Create an Android Project
Well, below steps will help you get started building your 1st Android Application. Before we get started – here is a final result of our application.
Everything you need to know to write your first Android Application
Step-1
This tutorial will help you to create your first android app
with the help of android studio
.
Demand is very increased of android apps as it is never be ignored at all. Android studio is an easy to use software which will help to develop better apps with easy interactive apps.
This tutorial will take roughly 30-60 minutes
, depending on how quickly you are able to download and install Android Studio. After using this tutorial to create your first Android app, you’ll be well on your way to a fun new hobby or possibly even a promising career in mobile development.
Step by step procedure to develop android app easily. 1st Install android studio:
- First of all you have to download android studio to make android application. To download it Go to http://developer.android.com/sdk/index.html to download Android Studio.
- Use the default installer to install Android Studio following its instructions.
You can easily download and it’s available to all the users freely without any further hectic steps.
Step-2 Open a new project
- Start Android Studio.
- It will Open Wizard called
Quick Start
Under theQuick Start
menu, click onStart a new Android Studio project
. - On the
Create New Project
window that will open project information wizard and by default it will give your application name toCrunchifyHelloWorld
. - then you need to add package name that might contain your company name. you can give name as desired. In our case we have provided package name:
tutorials.crunchify.com
- then choose where you want to store your project. So choose your project location.
- Click on
Next
.
Step-3
- Make sure on that
Phone and Tablet
is the only box that is checked. - If you want to test the app on your own phone, make sure the minimum SDK should be below your mobile’s OS level.
- Click on
Next
.
Step-4
- Select
Blank Activity
from list of all activities. - Click on
Next
. - Leave all of the Activity name fields as it is.
- Click on
Finish
.
This will create project structure like this:
Step-5. Open activity_main.xml file
- Double click on
activity_main.xml
file. - Click on TextView -> Change text value to your desire text
- Click on Button from Palette
- Click and drag Button to be centered underneath your
welcome message
. - Make sure your button is still selected.
- In the Properties menu (on the right side of the window), scroll down to find the field for
text
. - Change the text from
New Button
toNext Page
.
Step-7. Write button onClick() method
Open MainActivity.java
file.
package com.crunchify.tutorials.crunchifyhelloworld; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { goToSecondActivity(); } }); } private void goToSecondActivity() { Intent intent = new Intent(this, SecondActivity.class); startActivity(intent); } }
Just replace it with above code.
Step-8
Create file SecondActivity.java
file under the same file location as MainActivity.java
.
package com.crunchify.tutorials.crunchifyhelloworld; /** * Created by Crunchify on 7/5/17. */ public class SecondActivity { }
Test the application
Just click on Run
button and you will see device selection popup. Select Pixel API 26
and click OK
.
You should see now your application running under Android Simulation phone. And you are done! Congratulations.