A timeout variable for the intent

264 views
Skip to first unread message

Suhail Sherif

unread,
May 30, 2011, 3:05:50 AM5/30/11
to zxing
Pretty self-explanatory. It would be a good idea to allow the
developer to add a Timeout variable to the intent which causes zxing
to return cancelled if the scan was not successful in that amount of
time.

Daniel Switkin

unread,
May 31, 2011, 4:11:49 PM5/31/11
to Suhail Sherif, zxing
Do you have an app which needs this, or is it a "wouldn't it be cool if" request?

Suhail Sherif

unread,
Jun 1, 2011, 1:24:54 AM6/1/11
to Daniel Switkin, zxing
Hey, sorry for not replying earlier. The solution given by Lachezar works great. Thanks. Still new to Android, so I wasn't aware that activities can still make calls after calling another activity, although now that I think of it,it's pretty obvious it should be.

I needed it for an app, and it's fine now, although it still "would be cool if".

Robert Drabant

unread,
Apr 21, 2014, 3:29:18 PM4/21/14
to zx...@googlegroups.com, Daniel Switkin, suhail...@gmail.com
Where do I find the solution posted by Lachezar that you mentioned? Thanks in advance.

- Robert

Lachezar Dobrev

unread,
Apr 22, 2014, 5:11:57 AM4/22/14
to Robert Drabant, zxing, Daniel Switkin, Suhail Sherif
Apologies!
It seems I've sent the 'solution' off-list.

// You may choose a better uniqueness
final int requestCode;
requestCode = 0xBA7C0DE + (int) System.currentTimeMillis() % 1000;

final Intent intent;
intent = new Intent("com.google.zxing.client.android.SCAN");

// Start child activity
startActivityForResult(intent, requestCode);

// 3 seconds delay before forcibly finishing activity.
// onActivityResult() WILL be called.
new Handler(new Callback() {
@Override
public boolean handleMessage(Message msg) {
finishActivity(requestCode);
return false;
}
}).sendEmptyMessageDelayed(0, 3000);
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages