This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| protected void onResume() { | |
| super.onResume(); | |
| initialize(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { | |
| // If your preview can change or rotate, take care of those events here. | |
| // Make sure to stop the preview before resizing or reformatting it. | |
| if (mHolder.getSurface() == null) { | |
| // preview surface does not exist | |
| Log.d(TAG, "Preview Surface does not exist"); | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @SuppressWarnings("deprecation") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SimpleCameraPreview extends SurfaceView implements SurfaceHolder.Callback { | |
| private static final String TAG = "Simple Camera Preview"; | |
| private final SurfaceHolder mHolder; | |
| private final Camera mCamera; | |
| @SuppressWarnings("deprecation") | |
| public SimpleCameraPreview(Context context, Camera camera) { | |
| super(context); | |
| mCamera = camera; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <resources> | |
| <style name="Theme.SimpleCamera" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen" /> | |
| </resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <resources> | |
| <dimen name="control_panel_min_length">105dp</dimen> | |
| </resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style name="SimpleCamera" parent="android:Theme.Holo.NoActionBar.Fullscreen"> | |
| <item name="android:windowBackground">@android:color/black</item> | |
| <item name="android:colorBackground">@android:color/black</item> | |
| <item name="android:colorBackgroundCacheHint">@android:color/black</item> | |
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| style="@style/SimpleCamera" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:baselineAligned="false" | |
| tools:context=".SimpleCamera" > | |
| <FrameLayout | |
| android:id="@+id/camera_preview" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="com.craftingmobile.tutorials.simplecamera" | |
| android:versionCode="1" | |
| android:versionName="1.0" > | |
| <uses-sdk | |
| android:minSdkVersion="8" | |
| android:targetSdkVersion="16" /> | |
| <uses-permission android:name="android.permission.CAMERA" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <uses-feature android:name="android.hardware.camera" android:required="true"/> |