How To Create A Camera Application In Android Using Android Studio
Usman Alibaba Updated date Feb 26, 2020
99k 9 2
facebook.codeland technology
camera.rar<?xml version=”1.0″ encoding=”utf-8″?>
<android.support.constraint.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=”abu.camera.MainActivity”>
<RelativeLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:orientation=”vertical”>
<Button
android:id=”@+id/button1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentLeft=”true”
android:layout_alignParentTop=”true”
android:layout_marginLeft=”81dp”
android:layout_marginTop=”54dp”
android:text=”Button” />
</RelativeLayout>
</android.support.constraint.ConstraintLayout> # Corner
C# Corner Search
TECHNOLOGIES
ANSWERS
LEARN
NEWS
BLOGS
VIDEOS
INTERVIEW PREP
BOOKS
EVENTS
CAREER
MEMBERS
JOBS
How To Create A Camera Application In Android Using Android Studio
Abubackkar Shithik Abubackkar Shithik Updated date Feb 26, 2020
99k 9 2
Download Free .NET & JAVA Files API
Try Free File Format APIs for Word/Excel/PDF
camera.rar
Introduction
Android is one of the most popular operating systems for mobiles. In this article, I will show you how to start the camera application in Android using Android Studio.
Requirements
Android Studio version 2.3.3
Little bit XML and JAVA knowledge.
Android Emulator (or) Android mobile
Download link (Android Studio)
Steps to be followed
Follow these steps to create an application that starts the camera in Android. I have included the source code below.
Step 1
Open Android Studio and start a new Android Studio Project.
Android
Step 2
You can choose your application name and choose where your project is stored on the location. If you wish to use C++ for coding the project, mark the “Include C++ support”, and click the “Next” button.
Android
Now, select the version of Android and select the target Android devices.
Android
Step 3
Now, add the activity and click the “Next” button.
Android
Add activity name and click “Finish”.
Android
Step 4
Go to activity_main.xml, This XML file contains the designing code for your Android app.
Android
The XML code is given below.
<?xml version=”1.0″ encoding=”utf-8″?>
<android.support.constraint.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=”abu.camera.MainActivity”>
<RelativeLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:orientation=”vertical”>
<Button
android:id=”@+id/button1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentLeft=”true”
android:layout_alignParentTop=”true”
android:layout_marginLeft=”81dp”
android:layout_marginTop=”54dp”
android:text=”Button” />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
Step 5
Go to Main Activity.java. This Java program is the backend language for the Android app.
Android
The Java code is given below.
package abu.camera;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn=(Button)findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Introduction
Android is one of the most popular operating systems for mobiles. In this article, I will show you how to start the camera application in Android using Android Studio.
Requirements
Android Studio version 2.3.3
Little bit XML and JAVA knowledge.
Android Emulator (or) Android mobile
Download link (Android Studio)
Steps to be followed
Follow these steps to create an application that starts the camera in Android. I have included the source code below.
Step 1
Open Android Studio and start a new Android Studio Project.
Android
Step 2
You can choose your application name and choose where your project is stored on the location. If you wish to use C++ for coding the project, mark the “Include C++ support”, and click the “Next” button.
Android
Now, select the version of Android and select the target Android devices.
Android
Step 3
Now, add the activity and click the “Next” button.
Android
Add activity name and click “Finish”.
Android
Step 4
Go to activity_main.xml, This XML file contains the designing code for your Android app.
Android
The XML code is given below.
<?xml version=”1.0″ encoding=”utf-8″?>
<android.support.constraint.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=”abu.camera.MainActivity”>
<RelativeLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:orientation=”vertical”>
<Button
android:id=”@+id/button1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentLeft=”true”
android:layout_alignParentTop=”true”
android:layout_marginLeft=”81dp”
android:layout_marginTop=”54dp”
android:text=”Button” />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
Step 5
Go to Main Activity.java. This Java program is the backend language for the Android app.
Android
The Java code is given below.
package abu.camera;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn=(Button)findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}

