Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using Toast widget to display results from timer in image-manipulations

I'm modifying the image-manipulations sample application. I'm using System.currentTimeMillis() as a timer to measure performance of the application on several devices. I'm trying to display the results from timer on the screen. I use the following command:

           Toast.makeText(getContext(), "" + elapse + "ms is used
           to process", Toast.LENGTH_LONG).show();

When I try to run the part of the app, where the provided code is, the whole application crashes. The debugger shows me an error in SampleCvViewBase.java file in the first line of code:

            synchronized (this) {
            if (mCamera == null) {
                Log.i(TAG, "mCamera == null");
                break;
            }
            if (!mCamera.grab()) {
                Log.e(TAG, "mCamera.grab() failed");
                break;
            }
            bmp = processFrame(mCamera);

The main difference between original image-manipulations sample and my modification is that my app uses image from the internal memory instead from the onboard camera. How can I fix the error and display the results of the timer on the device screen?

Using Toast widget to display results from timer in image-manipulationsimage-manipulations Android app

I'm modifying the image-manipulations sample application. application for Android. I'm using System.currentTimeMillis() as a timer to measure performance of the application on several devices. I'm trying to display the results from timer on the screen. I use the following command:

           Toast.makeText(getContext(), "" + elapse + "ms is used
           to process", Toast.LENGTH_LONG).show();

When I try to run the part of the app, where the provided code is, the whole application crashes. The debugger shows me an error in SampleCvViewBase.java file in the first line of code:

            synchronized (this) {
            if (mCamera == null) {
                Log.i(TAG, "mCamera == null");
                break;
            }
            if (!mCamera.grab()) {
                Log.e(TAG, "mCamera.grab() failed");
                break;
            }
            bmp = processFrame(mCamera);

The main difference between original image-manipulations sample and my modification is that my app uses image from the internal memory instead from the onboard camera. How can I fix the error and display the results of the timer on the device screen?