Activity.finish() should be called from the UI thread. Try doing that and
post the result.

Cheers,
Gus

On Fri, Aug 21, 2015 at 10:24 AM, gc <gcst...@gmail.com> wrote:

> Just updating, if anyone can help it would be appreciated.  If you need
> more information please ask.
>
> I think this should be similar if you're using an Activity and showing
> video but not sure, how do you programmatically shut it down so the finish
> can occur and return to the prior Activity.
>
> Thank you for any help.
>
>
> On Monday, August 17, 2015 at 4:29:38 PM UTC-5, gc wrote:
>>
>> I'm implementing an Activity that uses a CameraSource and SurfaceView(to
>> show the camera's view) along with the new BarcodeDetector API and after
>> detection I'm trying to perform a finish() but it doesn't go back to the
>> prior Activity it just keeps running this one.
>>
>> Here is a code snippet from my onCreate Activity, as you can see once I
>> detect a barcode I attempt to call finish but it doesn't seem to do
>> anything.
>> Is there something I have to shutdown prior to this?
>>
>> I'm testing on a real device using Android 4.4.4
>>
>> barcodeDetector = new BarcodeDetector.Builder(context).build();
>> barcodeDetector.setProcessor(new
>> FocusingProcessor<Barcode>(barcodeDetector, new Tracker<Barcode>()) {
>>
>> @Override
>> public void receiveDetections(Detections<Barcode> detections) {
>> if(detections != null) {
>> SparseArray<Barcode> barcodes = detections.getDetectedItems();
>> if(barcodes != null && barcodes.size() > 0) {
>> int key = barcodes.keyAt(0);
>> Barcode bc = barcodes.get(key);
>> if(bc != null) {
>> barcode = bc.rawValue;
>> Intent resultData = new Intent();
>> resultData.putExtra("BARCODE", barcode);
>> setResult(Activity.RESULT_OK, resultData);
>> curActivity.finish();
>> }
>> }
>> }
>> }
>> }
>>
>> @Override
>> public void release() {
>> super.release();
>> }
>>
>> @Override
>> public int selectFocus(Detections<Barcode> arg0) {
>> return 0;
>> }
>> });
>> mCameraSource = new CameraSource.Builder(context, barcodeDetector)
>>                 .setFacing(CameraSource.CAMERA_FACING_BACK)
>>                 .build();
>>
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to