From 9f4c5afbbbd304a7f5069710ff4eeabf348e0f8c Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Sun, 15 Jul 2012 13:20:38 +0000 Subject: [PATCH] merging r9039-9040,9044 from trunk (warnings and message in Java) --- .../src/java/android+BaseLoaderCallback.java | 12 ++++++------ .../samples/puzzle15/puzzle15Activity.java | 19 +++++++++++++++++-- .../ColorBlobDetectionActivity.java | 19 +++++++++++++++++-- .../src/org/opencv/samples/fd/FdActivity.java | 19 +++++++++++++++++-- .../ImageManipulationsActivity.java | 19 +++++++++++++++++-- .../opencv/samples/tutorial0/Sample0Base.java | 2 +- .../opencv/samples/tutorial1/Sample1Java.java | 19 +++++++++++++++++-- .../tutorial2/Sample2NativeCamera.java | 19 +++++++++++++++++-- .../samples/tutorial3/Sample3Native.java | 19 +++++++++++++++++-- .../samples/tutorial4/Sample4Mixed.java | 19 +++++++++++++++++-- 10 files changed, 143 insertions(+), 23 deletions(-) diff --git a/modules/java/generator/src/java/android+BaseLoaderCallback.java b/modules/java/generator/src/java/android+BaseLoaderCallback.java index 35fa5bbe1..4a0b3545e 100644 --- a/modules/java/generator/src/java/android+BaseLoaderCallback.java +++ b/modules/java/generator/src/java/android+BaseLoaderCallback.java @@ -32,7 +32,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { RestartMessage.setTitle("OpenCV asks for restart"); RestartMessage.setMessage("Please, restart the application to finish installation."); RestartMessage.setCancelable(false); // This blocks the 'BACK' button - RestartMessage.setButton("OK", new OnClickListener() { + RestartMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAppContext.finish(); } @@ -48,7 +48,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { MarketErrorMessage.setTitle("OpenCV Manager"); MarketErrorMessage.setMessage("Package installation failed!"); MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button - MarketErrorMessage.setButton("OK", new OnClickListener() { + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAppContext.finish(); } @@ -69,7 +69,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { IncomatibilityMessage.setTitle("OpenCV Manager"); IncomatibilityMessage.setMessage("OpenCV Manager service is incompatible with this application. Update it!"); IncomatibilityMessage.setCancelable(false); // This blocks the 'BACK' button - IncomatibilityMessage.setButton("OK", new OnClickListener() { + IncomatibilityMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAppContext.finish(); } @@ -84,7 +84,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { InitFailedDialog.setTitle("OpenCV error"); InitFailedDialog.setMessage("OpenCV was not initialised correctly. Application will be shut down"); InitFailedDialog.setCancelable(false); // This blocks the 'BACK' button - InitFailedDialog.setButton("OK", new OnClickListener() { + InitFailedDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAppContext.finish(); @@ -102,7 +102,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { InstallMessage.setTitle("Package not found"); InstallMessage.setMessage(callback.getPackageName() + " package was not found! Try to install it?"); InstallMessage.setCancelable(false); // This blocks the 'BACK' button - InstallMessage.setButton("Yes", new OnClickListener() + InstallMessage.setButton(AlertDialog.BUTTON_POSITIVE, "Yes", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -110,7 +110,7 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { } }); - InstallMessage.setButton2("No", new OnClickListener() { + InstallMessage.setButton(AlertDialog.BUTTON_NEGATIVE, "No", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { diff --git a/samples/android/15-puzzle/src/org/opencv/samples/puzzle15/puzzle15Activity.java b/samples/android/15-puzzle/src/org/opencv/samples/puzzle15/puzzle15Activity.java index deae22376..60986c5fa 100644 --- a/samples/android/15-puzzle/src/org/opencv/samples/puzzle15/puzzle15Activity.java +++ b/samples/android/15-puzzle/src/org/opencv/samples/puzzle15/puzzle15Activity.java @@ -36,7 +36,7 @@ public class puzzle15Activity extends Activity AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -45,6 +45,21 @@ public class puzzle15Activity extends Activity ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -74,7 +89,7 @@ public class puzzle15Activity extends Activity AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java b/samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java index 5cdbdf220..0c7471891 100644 --- a/samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java +++ b/samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java @@ -31,7 +31,7 @@ public class ColorBlobDetectionActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -40,6 +40,21 @@ public class ColorBlobDetectionActivity extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -69,7 +84,7 @@ public class ColorBlobDetectionActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java b/samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java index 72fb39637..82a1910bf 100644 --- a/samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java +++ b/samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java @@ -45,7 +45,7 @@ public class FdActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -54,6 +54,21 @@ public class FdActivity extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -89,7 +104,7 @@ public class FdActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java b/samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java index d9d3ef132..7bacce3ac 100644 --- a/samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java +++ b/samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java @@ -54,7 +54,7 @@ public class ImageManipulationsActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -63,6 +63,21 @@ public class ImageManipulationsActivity extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -91,7 +106,7 @@ public class ImageManipulationsActivity extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/Sample0Base.java b/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/Sample0Base.java index a52aba405..a8b776598 100644 --- a/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/Sample0Base.java +++ b/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/Sample0Base.java @@ -36,7 +36,7 @@ public class Sample0Base extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java b/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java index e316021f3..6439e226f 100644 --- a/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java +++ b/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java @@ -36,7 +36,7 @@ public class Sample1Java extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -45,6 +45,21 @@ public class Sample1Java extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -73,7 +88,7 @@ public class Sample1Java extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java b/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java index e81d1c09c..e79c13fcf 100644 --- a/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java +++ b/samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java @@ -43,7 +43,7 @@ public class Sample2NativeCamera extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -52,6 +52,21 @@ public class Sample2NativeCamera extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -80,7 +95,7 @@ public class Sample2NativeCamera extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java b/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java index fa53eba83..1409a204b 100644 --- a/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java +++ b/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java @@ -34,7 +34,7 @@ public class Sample3Native extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -43,6 +43,21 @@ public class Sample3Native extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -71,7 +86,7 @@ public class Sample3Native extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); diff --git a/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java b/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java index 6a85abc31..6cd08ef25 100644 --- a/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java +++ b/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java @@ -42,7 +42,7 @@ public class Sample4Mixed extends Activity { AlertDialog ad = new AlertDialog.Builder(mAppContext).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); @@ -51,6 +51,21 @@ public class Sample4Mixed extends Activity { ad.show(); } } break; + /** OpenCV loader cannot start Google Play **/ + case LoaderCallbackInterface.MARKET_ERROR: + { + Log.d(TAG, "Google Play service is not accessible!"); + AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create(); + MarketErrorMessage.setTitle("OpenCV Manager"); + MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install' command."); + MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button + MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + mAppContext.finish(); + } + }); + MarketErrorMessage.show(); + } break; default: { super.onManagerConnected(status); @@ -79,7 +94,7 @@ public class Sample4Mixed extends Activity { AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Fatal error: can't open camera!"); - ad.setButton("OK", new DialogInterface.OnClickListener() { + ad.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish();