From 65bff27967c6791dd9ee488ed425be35f515b3e0 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 6 Sep 2013 18:40:09 +0100 Subject: initial commit --- AndroidManifest.xml | 32 +++ bin/AndroidManifest.xml | 32 +++ bin/RotorM.apk | Bin 0 -> 258236 bytes bin/RotorM1.apk | Bin 0 -> 258233 bytes bin/classes.dex | Bin 0 -> 627160 bytes bin/classes/com/example/rotorm/BuildConfig.class | Bin 0 -> 345 bytes bin/classes/com/example/rotorm/MainActivity.class | Bin 0 -> 7099 bytes bin/classes/com/example/rotorm/R$attr.class | Bin 0 -> 340 bytes bin/classes/com/example/rotorm/R$dimen.class | Bin 0 -> 461 bytes bin/classes/com/example/rotorm/R$drawable.class | Bin 0 -> 407 bytes bin/classes/com/example/rotorm/R$id.class | Bin 0 -> 431 bytes bin/classes/com/example/rotorm/R$layout.class | Bin 0 -> 431 bytes bin/classes/com/example/rotorm/R$menu.class | Bin 0 -> 388 bytes bin/classes/com/example/rotorm/R$string.class | Bin 0 -> 472 bytes bin/classes/com/example/rotorm/R$style.class | Bin 0 -> 431 bytes bin/classes/com/example/rotorm/R.class | Bin 0 -> 673 bytes ...support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar | Bin 0 -> 211326 bytes ...support-v4-b95a6b732be9494db93a4f243ef4c509.jar | Bin 0 -> 211326 bytes bin/jarlist.cache | 3 + bin/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 5964 bytes bin/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 3112 bytes bin/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 9355 bytes bin/res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 17889 bytes bin/resources.ap_ | Bin 0 -> 41373 bytes gen/com/example/rotorm/BuildConfig.java | 6 + gen/com/example/rotorm/R.java | 70 ++++++ ic_launcher-web.png | Bin 0 -> 51394 bytes libs/android-support-v4.jar | Bin 0 -> 556198 bytes proguard-project.txt | 20 ++ project.properties | 14 ++ res/drawable-hdpi/ic_launcher.png | Bin 0 -> 7658 bytes res/drawable-mdpi/ic_launcher.png | Bin 0 -> 3777 bytes res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 12516 bytes res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 24777 bytes res/layout/activity_main.xml | 16 ++ res/layout/main.xml | 9 + res/menu/main.xml | 9 + res/values-sw600dp/dimens.xml | 8 + res/values-sw720dp-land/dimens.xml | 9 + res/values-v11/styles.xml | 11 + res/values-v14/styles.xml | 12 + res/values/dimens.xml | 7 + res/values/strings.xml | 8 + res/values/styles.xml | 20 ++ src/com/example/rotorm/MainActivity.java | 259 +++++++++++++++++++++ 45 files changed, 545 insertions(+) create mode 100644 AndroidManifest.xml create mode 100644 bin/AndroidManifest.xml create mode 100644 bin/RotorM.apk create mode 100644 bin/RotorM1.apk create mode 100644 bin/classes.dex create mode 100644 bin/classes/com/example/rotorm/BuildConfig.class create mode 100644 bin/classes/com/example/rotorm/MainActivity.class create mode 100644 bin/classes/com/example/rotorm/R$attr.class create mode 100644 bin/classes/com/example/rotorm/R$dimen.class create mode 100644 bin/classes/com/example/rotorm/R$drawable.class create mode 100644 bin/classes/com/example/rotorm/R$id.class create mode 100644 bin/classes/com/example/rotorm/R$layout.class create mode 100644 bin/classes/com/example/rotorm/R$menu.class create mode 100644 bin/classes/com/example/rotorm/R$string.class create mode 100644 bin/classes/com/example/rotorm/R$style.class create mode 100644 bin/classes/com/example/rotorm/R.class create mode 100644 bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar create mode 100644 bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar create mode 100644 bin/jarlist.cache create mode 100644 bin/res/drawable-hdpi/ic_launcher.png create mode 100644 bin/res/drawable-mdpi/ic_launcher.png create mode 100644 bin/res/drawable-xhdpi/ic_launcher.png create mode 100644 bin/res/drawable-xxhdpi/ic_launcher.png create mode 100644 bin/resources.ap_ create mode 100644 gen/com/example/rotorm/BuildConfig.java create mode 100644 gen/com/example/rotorm/R.java create mode 100644 ic_launcher-web.png create mode 100644 libs/android-support-v4.jar create mode 100644 proguard-project.txt create mode 100644 project.properties create mode 100644 res/drawable-hdpi/ic_launcher.png create mode 100644 res/drawable-mdpi/ic_launcher.png create mode 100644 res/drawable-xhdpi/ic_launcher.png create mode 100644 res/drawable-xxhdpi/ic_launcher.png create mode 100644 res/layout/activity_main.xml create mode 100644 res/layout/main.xml create mode 100644 res/menu/main.xml create mode 100644 res/values-sw600dp/dimens.xml create mode 100644 res/values-sw720dp-land/dimens.xml create mode 100644 res/values-v11/styles.xml create mode 100644 res/values-v14/styles.xml create mode 100644 res/values/dimens.xml create mode 100644 res/values/strings.xml create mode 100644 res/values/styles.xml create mode 100644 src/com/example/rotorm/MainActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..114166c --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml new file mode 100644 index 0000000..114166c --- /dev/null +++ b/bin/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/RotorM.apk b/bin/RotorM.apk new file mode 100644 index 0000000..6969af7 Binary files /dev/null and b/bin/RotorM.apk differ diff --git a/bin/RotorM1.apk b/bin/RotorM1.apk new file mode 100644 index 0000000..ce2906f Binary files /dev/null and b/bin/RotorM1.apk differ diff --git a/bin/classes.dex b/bin/classes.dex new file mode 100644 index 0000000..3ab90a9 Binary files /dev/null and b/bin/classes.dex differ diff --git a/bin/classes/com/example/rotorm/BuildConfig.class b/bin/classes/com/example/rotorm/BuildConfig.class new file mode 100644 index 0000000..0e9c261 Binary files /dev/null and b/bin/classes/com/example/rotorm/BuildConfig.class differ diff --git a/bin/classes/com/example/rotorm/MainActivity.class b/bin/classes/com/example/rotorm/MainActivity.class new file mode 100644 index 0000000..44b3a35 Binary files /dev/null and b/bin/classes/com/example/rotorm/MainActivity.class differ diff --git a/bin/classes/com/example/rotorm/R$attr.class b/bin/classes/com/example/rotorm/R$attr.class new file mode 100644 index 0000000..b91c9ba Binary files /dev/null and b/bin/classes/com/example/rotorm/R$attr.class differ diff --git a/bin/classes/com/example/rotorm/R$dimen.class b/bin/classes/com/example/rotorm/R$dimen.class new file mode 100644 index 0000000..a9ba10a Binary files /dev/null and b/bin/classes/com/example/rotorm/R$dimen.class differ diff --git a/bin/classes/com/example/rotorm/R$drawable.class b/bin/classes/com/example/rotorm/R$drawable.class new file mode 100644 index 0000000..8bbf9bb Binary files /dev/null and b/bin/classes/com/example/rotorm/R$drawable.class differ diff --git a/bin/classes/com/example/rotorm/R$id.class b/bin/classes/com/example/rotorm/R$id.class new file mode 100644 index 0000000..9c7852d Binary files /dev/null and b/bin/classes/com/example/rotorm/R$id.class differ diff --git a/bin/classes/com/example/rotorm/R$layout.class b/bin/classes/com/example/rotorm/R$layout.class new file mode 100644 index 0000000..2ba895d Binary files /dev/null and b/bin/classes/com/example/rotorm/R$layout.class differ diff --git a/bin/classes/com/example/rotorm/R$menu.class b/bin/classes/com/example/rotorm/R$menu.class new file mode 100644 index 0000000..8fd5581 Binary files /dev/null and b/bin/classes/com/example/rotorm/R$menu.class differ diff --git a/bin/classes/com/example/rotorm/R$string.class b/bin/classes/com/example/rotorm/R$string.class new file mode 100644 index 0000000..868990e Binary files /dev/null and b/bin/classes/com/example/rotorm/R$string.class differ diff --git a/bin/classes/com/example/rotorm/R$style.class b/bin/classes/com/example/rotorm/R$style.class new file mode 100644 index 0000000..9b41eed Binary files /dev/null and b/bin/classes/com/example/rotorm/R$style.class differ diff --git a/bin/classes/com/example/rotorm/R.class b/bin/classes/com/example/rotorm/R.class new file mode 100644 index 0000000..c619ba5 Binary files /dev/null and b/bin/classes/com/example/rotorm/R.class differ diff --git a/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar b/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar new file mode 100644 index 0000000..f7620ee Binary files /dev/null and b/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar differ diff --git a/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar b/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar new file mode 100644 index 0000000..1be9980 Binary files /dev/null and b/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar differ diff --git a/bin/jarlist.cache b/bin/jarlist.cache new file mode 100644 index 0000000..0565465 --- /dev/null +++ b/bin/jarlist.cache @@ -0,0 +1,3 @@ +# cache for current jar dependency. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/bin/res/drawable-hdpi/ic_launcher.png b/bin/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..efa7c5f Binary files /dev/null and b/bin/res/drawable-hdpi/ic_launcher.png differ diff --git a/bin/res/drawable-mdpi/ic_launcher.png b/bin/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..ec27f2e Binary files /dev/null and b/bin/res/drawable-mdpi/ic_launcher.png differ diff --git a/bin/res/drawable-xhdpi/ic_launcher.png b/bin/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..92fc57d Binary files /dev/null and b/bin/res/drawable-xhdpi/ic_launcher.png differ diff --git a/bin/res/drawable-xxhdpi/ic_launcher.png b/bin/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..b6f8f4e Binary files /dev/null and b/bin/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ new file mode 100644 index 0000000..93b621a Binary files /dev/null and b/bin/resources.ap_ differ diff --git a/gen/com/example/rotorm/BuildConfig.java b/gen/com/example/rotorm/BuildConfig.java new file mode 100644 index 0000000..b14ab5f --- /dev/null +++ b/gen/com/example/rotorm/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.example.rotorm; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/gen/com/example/rotorm/R.java b/gen/com/example/rotorm/R.java new file mode 100644 index 0000000..f070dbb --- /dev/null +++ b/gen/com/example/rotorm/R.java @@ -0,0 +1,70 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.example.rotorm; + +public final class R { + public static final class attr { + } + public static final class dimen { + /** Default screen margins, per the Android Design guidelines. + + Customize dimensions originally defined in res/values/dimens.xml (such as + screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. + + */ + public static final int activity_horizontal_margin=0x7f040000; + public static final int activity_vertical_margin=0x7f040001; + } + public static final class drawable { + public static final int ic_launcher=0x7f020000; + } + public static final class id { + public static final int action_settings=0x7f080001; + public static final int surface_camera=0x7f080000; + } + public static final class layout { + public static final int activity_main=0x7f030000; + public static final int main=0x7f030001; + } + public static final class menu { + public static final int main=0x7f070000; + } + public static final class string { + public static final int action_settings=0x7f050001; + public static final int app_name=0x7f050000; + public static final int hello_world=0x7f050002; + } + public static final class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f060000; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f060001; + } +} diff --git a/ic_launcher-web.png b/ic_launcher-web.png new file mode 100644 index 0000000..a18cbb4 Binary files /dev/null and b/ic_launcher-web.png differ diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar new file mode 100644 index 0000000..cf12d28 Binary files /dev/null and b/libs/android-support-v4.jar differ diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..ce39f2d --- /dev/null +++ b/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-18 diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 Binary files /dev/null and b/res/drawable-hdpi/ic_launcher.png differ diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b Binary files /dev/null and b/res/drawable-mdpi/ic_launcher.png differ diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd Binary files /dev/null and b/res/drawable-xhdpi/ic_launcher.png differ diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 Binary files /dev/null and b/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml new file mode 100644 index 0000000..168c9b8 --- /dev/null +++ b/res/layout/activity_main.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/res/layout/main.xml b/res/layout/main.xml new file mode 100644 index 0000000..40bfa59 --- /dev/null +++ b/res/layout/main.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/res/menu/main.xml b/res/menu/main.xml new file mode 100644 index 0000000..c002028 --- /dev/null +++ b/res/menu/main.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..44f01db --- /dev/null +++ b/res/values-sw600dp/dimens.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml new file mode 100644 index 0000000..61e3fa8 --- /dev/null +++ b/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,9 @@ + + + + 128dp + + diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml new file mode 100644 index 0000000..55c1e59 --- /dev/null +++ b/res/values/dimens.xml @@ -0,0 +1,7 @@ + + + + 16dp + 16dp + + diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..69f1d0c --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + RotorM + Settings + Hello world! + + diff --git a/res/values/styles.xml b/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/src/com/example/rotorm/MainActivity.java b/src/com/example/rotorm/MainActivity.java new file mode 100644 index 0000000..c88d6fd --- /dev/null +++ b/src/com/example/rotorm/MainActivity.java @@ -0,0 +1,259 @@ +package com.example.rotorm; + + +import java.io.File; +import java.io.IOException; +import java.util.Date; + +import com.example.rotorm.R; + +import android.hardware.Camera; +import android.hardware.Camera.Parameters; +import android.media.MediaPlayer; +import android.media.MediaRecorder; +import android.net.Uri; +import android.os.Bundle; +import android.os.Environment; +import android.app.Activity; +import android.content.Intent; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.SurfaceHolder.Callback; +import android.widget.Toast; + +public class MainActivity extends Activity implements Callback { + + @Override + protected void onDestroy() { + //stopRecording(); + super.onDestroy(); + } + + private SurfaceHolder surfaceHolder; + private SurfaceView surfaceView; + public MediaRecorder mrec = new MediaRecorder(); + private Camera mCamera; + private Uri uriSound; + MediaPlayer mp; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + uriSound=Uri.parse(""); + + Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); + startActivityForResult(intent, 10); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, 0, 0, "Start"); + //menu.add(0, 0, 0, "Pick audio track"); + return super.onCreateOptionsMenu(menu); + // Inflate the menu; this adds items to the action bar if it is present. + //getMenuInflater().inflate(R.menu.main, menu); + //return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + if(item.getTitle().equals("Start")) + { + try { + + startRecording(); + item.setTitle("Stop"); + + } catch (Exception e) { + + String message = e.getMessage(); + Log.i(null, "Problem " + message); + mrec.release(); + } + + } + else if(item.getTitle().equals("Stop")) + { + mrec.stop(); + mrec.release(); + mrec = null; + item.setTitle("Start"); + mp.stop(); + } + else if(item.getTitle().equals("Pick audio track")) + { + Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); + startActivityForResult(intent, 10); + } + + return super.onOptionsItemSelected(item); + } + + protected void startPreview() throws IOException { + + //http://stackoverflow.com/questions/12098298/android-camera-app-passed-null-surface + if(mCamera==null) mCamera = Camera.open(); + + setContentView(R.layout.main); + + surfaceView = (SurfaceView) findViewById(R.id.surface_camera); + + surfaceHolder = surfaceView.getHolder(); + surfaceHolder.addCallback(this); + surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + + //mCamera.lock(); + //mCamera.unlock(); + + mCamera.setPreviewDisplay(surfaceHolder); + mCamera.startPreview(); + + } + + protected void startRecording() throws IOException + { + if(mCamera==null) + mCamera = Camera.open(); + + String filename; + String path; + + path= Environment.getExternalStorageDirectory().getAbsolutePath().toString(); + + Date date=new Date(); + filename="/rec"+date.toString().replace(" ", "_").replace(":", "_")+".mp4"; + + Log.i(null, "Saving video file: " + filename); + + //create empty file it must use + File file=new File(path,filename); + + mrec = new MediaRecorder(); + + mCamera.lock(); + mCamera.unlock(); + + // Please maintain sequence of following code. + + // If you change sequence it will not work. + mrec.setCamera(mCamera); + mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA); + //mrec.setAudioSource(MediaRecorder.AudioSource.MIC); + mrec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); + mrec.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP); + //mrec.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); + mrec.setPreviewDisplay(surfaceHolder.getSurface()); + mrec.setOutputFile(path+filename); + mrec.prepare(); + mrec.start(); + + Log.i(null, "Audio file: " + uriSound); + + //try { + //MediaPlayer mp = new MediaPlayer(); + //MediaPlayer mp = MediaPlayer.create(this, R.raw.stick); + mp = MediaPlayer.create(this, uriSound); + //mp.setDataSource(this, uriSound); + mp.start(); + ///} catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + //} catch (SecurityException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + //} catch (IllegalStateException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + //} catch (IOException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + //} + } + + protected void stopRecording() { + + if(mrec!=null) + { + mrec.stop(); + mrec.release(); + mCamera.release(); + mCamera.lock(); + } + + mp.stop(); + } + + private void releaseMediaRecorder() { + + if (mrec != null) { + mrec.reset(); // clear recorder configuration + mrec.release(); // release the recorder object + } + } + + private void releaseCamera() { + if (mCamera != null) { + mCamera.release(); // release the camera for other applications + mCamera = null; + } + + } + + @Override + public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) { + + } + + @Override + public void surfaceCreated(SurfaceHolder holder) { + + if (mCamera != null) { + Parameters params = mCamera.getParameters(); + mCamera.setParameters(params); + Log.i("Surface", "Created"); + } + else { + Toast.makeText(getApplicationContext(), "Camera not available!", + Toast.LENGTH_LONG).show(); + + finish(); + } + + } + + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + mCamera.stopPreview(); + mCamera.release(); + //http://stackoverflow.com/questions/13235306/method-called-after-release-exception-camera-preview + //mCamera=null; + } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + + //if(requestCode == RESULT_OK && requestCode == 10){ + uriSound=data.getData(); + + Log.i("Sound file",uriSound.toString()); + + //String temp="audioFileName"; + //this.getIntent().getStringExtra(temp); + //uriSound=Uri.parse(temp); + //uriSound=Uri.parse("/Music/stick.mp3"); + try { + startPreview(); + } catch (IOException e) { + Log.e("Preview","Error"); + e.printStackTrace(); + } + + //} + } + +} -- cgit v1.2.3