Create First Android Apps in Android Studio
We need to some Software And Programming Knowledge to Create an android Application
here below list
Prerequisites
Programming Knowledge :
- Java or Kotlin
- XML
Software :
1. JAVA ( recomended JAVA 11)
2. IDE - Android Studio ( latest )
3. Windows Operating System
4. Emulator for testing virtual apps
or
5. Physical Android Mobile ( for testing in Mobile )
following steps to create first Android Apps
Step 1
Open Android Studio in Windows
In Android Studio click on "File" , next click "New" , Next Click "New Project
in sort - in Android Studio >> File >> New >> New Project
Step 2 :
Choose Option - "Phone and Tablet" and next select "Empty View Activity" after click below Next Button
below ScreenShot Image
after Click Next
Step 3
write project Name - example - "FirstAndroidApp"
select location folder - where you want to save project
next choose language - Java Or Kotlin
next select Version minimum SDK in "Lollipoop 5.0"
after click on Finish Button -
as see in screenshot image
Step 4
now clicking finish button wait some times ( until finishing , first time take More time)
finishing after see three Source code Files Folders
1. MainActivity.java
2. Activity_man.xml
3. manifest.xml
below screenshot image
Step 4 -
now Write Source Code -
1. MainActivity.java
Go to app >> java >> MainActivity.xml
Source Code :
package com.example.firstandroidapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}2. activity_main.xml
Go to app > layouts > activity_main.xml
Source Code :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> 3. manifest.xml No Need to Change
Source Code :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.FirstAndroidApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest> Step 5:
After Solve All Error And Warning to Need Build Application
Click on "Build" after Select " Make Project" or Sortcut - "CTR + F9"
Wait few time after Succesfully build
then need to
click on "Run" and after select 'Run App'
here select Virtual Emulator or connect to Physical Mobile to install new Application
after install please test Applcation
0 Comments