How to use intents from Barcode Scanner?

Put your problem here if it does not fit any of the other categories.

How to use intents from Barcode Scanner?

Postby JUSTINB » Thu Oct 30, 2008 8:55 am

Hey everyone! I've been lurking around reading all the wonderful stuff you guys have posted. Thanks!

One thing I don't quite understand, is how to use intents from another app, specifically the Barcode Scanner.

In case it may help to explain what I want to do-- I want to create an application that uses Barcode Scanner's scanning intent, search a database (such as upcdatabase.com) to obtain the item name. After it's done that, the user will enter in the size of the product, and the POS price along with some other info to then save it to a database. The app will do other stuff, but that's the basics. I know it sounds odd, but it's not going to be a public use application (although it certainly could modified to be).

Thanks! I searched around for this information but didn't find exactly what I was looking for.
JUSTINB
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 30, 2008 8:37 am

Top

Postby MrSnowflake » Thu Oct 30, 2008 9:31 am

The action string for the intent for starting the BarCode scanner is "com.google.zxing.client.android.SCAN". So you should make a new intent and start a new activity with this intent:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent i = new Intent(this, "com.google.zxing.client.android.SCAN");
  2.  
  3. i.addCategory(Intent.CATEGORY_DEFAULT);
  4.  
  5. startActivityForResult(i);
  6.  
  7.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Also you have to set the catagory to "android.intent.category.DEFAULT". But I suppose DEFAULT will be the, well, default catagory.
I'm writing this out of my head so it could be off, but then you have a little direction :).
Last edited by MrSnowflake on Thu Oct 30, 2008 9:38 am, edited 3 times in total.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby JUSTINB » Thu Oct 30, 2008 9:34 am

Thanks! This should help out a lot.
JUSTINB
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 30, 2008 8:37 am

Postby MrSnowflake » Thu Oct 30, 2008 9:39 am

I updated my code, it should be working now, as far as it's possible to work from my head.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 21 guests