SlideServe
Menu
Préférences
© SlideServe · v2026

Android Introduction

dmore avatar
6 diapositives · 116 Views · Jan 03, 2020

Learn how to create an Android app that launches the camera, captures an image, and displays it using this tutorial. Includes layout design, camera launching, and result handling.

Android Introduction - slide 1
01 / 6Android Introduction
1 / 17

Télécharger la présentation

Android Introduction
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Android Introduction Camera @2011 Mihail L. Sichitiu Many thanks to Jun Bum Lim for his help with this tutorial.

  2. Goal • Create an application that launches the built-in Camera and use the results for displaying the captured image. @2010 Mihail L. Sichitiu

  3. Layout • Make a LinearLayout with • a TextView, • a Button, and • an ImageView • Create a handler for the OnClick event of the Button @2010 Mihail L. Sichitiu

  4. Launch Camera • Creating an Intent, as follows, within your button click handler: Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); • Launch camera activity with asking result: startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);   • define within your application as the request code returned by the Camera image capture Intent privatestaticfinalintCAMERA_PIC_REQUEST = 1;  @2010 Mihail L. Sichitiu

  5. Handling result from Camera • By adding onActivityResult() in your Activity: protectedvoidonActivityResult(int requestCode, int resultCode, Intent data) {   if (requestCode == CAMERA_PIC_REQUEST) { // display image            Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); ImageView imageTakePic = (ImageView) findViewById(R.id.imageViewPhone); imageTakePic.setImageBitmap(thumbnail);     }   }  @2010 Mihail L. Sichitiu

  6. Enforcing Device Requirement <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ucab.test.camera" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="7" /> <uses-feature android:name="android.hardware.camera"></uses-feature> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".AndroidCameraActivity" android:label="@string/app_name"> <intent-filter> : : Application wants a camera It is not enforced by Android @2010 Mihail L. Sichitiu