Beispiel #1
0
        /// <summary>
        /// Starts back ground thread that callback from camera will posted.
        /// </summary>
        private void startBackgroundThread()
        {
            mBackgroundHandlerThread = new HandlerThread("Background Thread");
            mBackgroundHandlerThread.start();
            mBackgroundHandler = new Handler(mBackgroundHandlerThread.Looper);

            mReaderHandlerThread = new HandlerThread("Reader Thread");
            mReaderHandlerThread.start();
            mReaderHandler = new Handler(mReaderHandlerThread.Looper);
        }
        public override void onCreate()
        {
            base.onCreate();
            mAccessory = new SA();
            try
            {
                mAccessory.initialize(this);
            }
            catch (SsdkUnsupportedException e)
            {
                // try to handle SsdkUnsupportedException
                if (processUnsupportedException(e) == true)
                {
                    return;
                }
            }
            catch (Exception e1)
            {
                Console.WriteLine(e1.ToString());
                Console.Write(e1.StackTrace);

                /*
                 * Your application can not use Samsung Accessory SDK. Your application should work smoothly
                 * without using this SDK, or you may want to notify user and close your application gracefully
                 * (release resources, stop Service threads, close UI thread, etc.)
                 */
                stopSelf();
            }
            mThread = new HandlerThread("GalleryProvider");
            mThread.start();
            mLooper = mThread.Looper;
            if (mLooper != null)
            {
                mBackgroundHandler = new Handler(mLooper);
            }
            else
            {
                throw new Exception("Could not get Looper from Handler Thread");
            }
        }
		/// <summary>
		/// Starts back ground thread that callback from camera will posted.
		/// </summary>
		private void startBackgroundThread()
		{
			mBackgroundHandlerThread = new HandlerThread("Background Thread");
			mBackgroundHandlerThread.start();
			mBackgroundHandler = new Handler(mBackgroundHandlerThread.Looper);

			mReaderHandlerThread = new HandlerThread("Reader Thread");
			mReaderHandlerThread.start();
			mReaderHandler = new Handler(mReaderHandlerThread.Looper);
		}
		public override void onCreate()
		{
			base.onCreate();
			mAccessory = new SA();
			try
			{
				mAccessory.initialize(this);
			}
			catch (SsdkUnsupportedException e)
			{
				// try to handle SsdkUnsupportedException
				if (processUnsupportedException(e) == true)
				{
					return;
				}
			}
			catch (Exception e1)
			{
				Console.WriteLine(e1.ToString());
				Console.Write(e1.StackTrace);
				/*
				 * Your application can not use Samsung Accessory SDK. Your application should work smoothly
				 * without using this SDK, or you may want to notify user and close your application gracefully
				 * (release resources, stop Service threads, close UI thread, etc.)
				 */
				stopSelf();
			}
			mThread = new HandlerThread("GalleryProvider");
			mThread.start();
			mLooper = mThread.Looper;
			if (mLooper != null)
			{
				mBackgroundHandler = new Handler(mLooper);
			}
			else
			{
				throw new Exception("Could not get Looper from Handler Thread");
			}
		}
		/// <summary>
		/// Starts back ground thread that callback from camera will posted.
		/// </summary>
		private void startBackgroundThread()
		{
			mBackgroundHandlerThread = new HandlerThread("Background Thread");
			mBackgroundHandlerThread.start();
			mBackgroundHandler = new Handler(mBackgroundHandlerThread.Looper);

			mImageSavingHandlerThread = new HandlerThread("Saving Thread");
			mImageSavingHandlerThread.start();
			mImageSavingHandler = new Handler(mImageSavingHandlerThread.Looper);
		}