0

I need to classify an images recorded by my camera as often as possible in a infinite loop. Every classification takes about 0.5 seconds. What is the best way to implement this in android?

So far I tried to add a Handler inside onCreate, but it seems I cannot just call my method from there:

@Override
protected void onCreate(Bundle savedInstanceState) {
    [...]
    mHandler = new Handler();
    Runnable mRunnable = new Runnable() {
        @Override
        public void run() {
            Log.d("myLog","run was called");
            mHandler.postDelayed(this, 1000);
            TakeScreenshot(); // <-- this is my method which doesn't work 
        }
    };

    mHandler.postDelayed(mRunnable,1000);

}

The method TakeScreenshot(); is taken from this post. I basically need to modify it such that it takes a screenshot as often as it can instead of only after pressing the button.

Community
  • 1
  • 1
mcExchange
  • 6,154
  • 12
  • 57
  • 103

0 Answers0