1.       Manifest File:
| 
AndroidManifest.xml | 
| 
<?xml version="1.0" encoding="utf-8"?> 
<!-- the package name and the version of the application extracted from the appinfo tag in the AM --> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="edu.icpmd.camera" 
android:versionCode="1" 
android:versionName="1.0.0.0"> 
<uses-sdk 
        android:minSdkVersion="8" 
        android:targetSdkVersion="17" /> 
<!-- the permissions list extracted from the permissions tag in the AM and the permissions database --> 
<!-- the icon and label of the application extracted from the appinfo tag in the AM --> 
<application      android:icon="@drawable/applicationicon" 
android:label="CameraApp"  > 
<!-- the default activity name is extracted from the appinfo tag in the AM --> 
<activity      android:name="edu.icpmd.camera.MainPage"         
android:label="Camera" > 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity> 
</application> 
</manifest> | 
2.       User Interface (UI) File:
| 
Res/layout/mainpage.xml | 
| 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" 
tools:context=".MainPage" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
android:orientation="vertical"> 
<TableLayout 
    android:id="@+id/LayoutRoot" 
    android:layout_width="match_parent"  
android:layout_height="match_parent" > 
<TableRow 
    android:layout_width="match_parent" android:layout_height="wrap_content" > 
<LinearLayout 
    android:id="@+id/TitlePanel" 
    android:layout_width="match_parent" 
   android:layout_height="wrap_content" 
    android:paddingBottom="28dp" 
    android:paddingLeft="12dp" 
    android:paddingRight="0dp" 
    android:paddingTop="17dp" > 
<TextView 
    android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
    android:text="MY APPLICATION" /> 
<TextView 
    android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
    android:paddingBottom="0dp" 
    android:paddingLeft="9dp" 
    android:paddingRight="0dp" 
    android:paddingTop="-7dp" 
    android:text="Camera App" /> 
</LinearLayout></TableRow> 
<TableRow 
    android:layout_width="fill_parent" 
android:layout_height="wrap_content" > 
<RelativeLayout 
    android:id="@+id/contentpanel" 
    android:layout_width="fill_parent"    android:layout_height="wrap_content" 
android:paddingBottom="0dp" 
    android:paddingLeft="12dp" 
    android:paddingRight="12dp" 
    android:paddingTop="0dp" 
    android:text="Camera App" > 
<Button 
    android:id="@+id/capture"    android:layout_height="wrap_content"  android:layout_below="@+id/image1" 
android:onClick="cameraCapture_Click" 
    android:paddingBottom="0dp" 
    android:paddingLeft="49dp" 
    android:paddingRight="0dp" 
    android:paddingTop="412dp" 
    android:layout_width="334dp" 
    android:layout_height="72dp" 
    android:text="Camera Capture" > 
</Button> 
<ImageView  android:id="@+id/image1" 
  android:paddingBottom="0dp" 
android:paddingLeft="25dp" 
android:paddingRight="0dp" 
android:paddingTop="19dp" 
android:layout_width="406dp" 
android:layout_height="269dp"   
android:layout_below="@+id/button1"/> 
</RelativeLayout> 
</TableRow></TableLayout> 
</LinearLayout> | 
3.       Code File:
| 
src/edu/icpmd/miniBrowser/MainPage.java | 
| 
package edu.icpmd.camera; 
import android.app.Activity; 
import android.content.Intent; 
import android.graphics.Bitmap; 
import android.os.Bundle; 
import android.view.View; 
import android.widget.ImageView; 
public class MainPage extends Activity { 
ImageView image1; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.mainpage);   
image1 = (ImageView) findViewById(R.id.image1); 
} 
public void cameraCapture_Click(View arg0) 
    { 
Intent cameraCaptureTask = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(cameraCaptureTask,0) 
    } 
@Override 
   protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
      super.onActivityResult(requestCode, resultCode, data); 
if (resultCode == RESULT_OK) 
{ 
Bitmap bmp = (Bitmap) data.getExtras().get("data"); 
      image1.setImageBitmap(bmp); 
} 
} 
} | 
