im new to all the programming stuff so please forgive me If my question is rather stupid ;)
I integrated zxing directly as a library and now im trying to scan some QR Codes and get the result. But sadly I have no idea how to get it.
I found some hints that it works with "onActivityResult(int requestCode, int resultCode, Intent intent) "and for that i have to declare a new intent like this
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
But if I copy this code to my app, it will always try to open a thirdparty app. Thats exactly what i dont want.
Im sure my mistake is very obvious, but I dont see it ;) Would be happy about every help.
If I'm not getting you wrong, you want to display ZXing natively.
To do that please follow this tutorial
http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
In case of any doubt please let me know.
Regards.
Related
I'm currently working on QR code scanner. I want to ask if it is possible to open another activity after the QR code have been scanned rather than getting it displayed as a toast?
I've solved the problem already .Thank you guys, I'm sorry for asking for such a simple question. I'm really new to android programming.
public void scanResult(ScanResult result) {
Toast.makeText(this, result.getRawResult().getText(), Toast.LENGTH_LONG).show();
}
Why not? What seems to be the problem? In which file is your scanResult located/ do you have access to the Context?
As normal just use
Intent intent = new Intent(MyActivity.this, StartThisActivity.class);
startActivity(intent);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent,TAKE_PHOTO_WITH_DATA);
Hi all,I got two questions.
the code above show an "TAKE_PHOTO_WITH_DATA cannot be resolved to a variable" error,
I use sdk 2.2.3 but change to 4.2.2 the error still there,
what's wrong with "TAKE_PHOTO_WITH_DATA"?
by the way,
Is there any "TAKE_VIDEO_WITH_DATA" or "TAKE_SOUND_WITH_DATA" can use?
thanks a lot.
It will show an error as long as you don't declare the particular variable,TAKE_PHOTO_WITH_DATA is nothing but a request code,you can even use an integer directly instead of this like startActivityForResult(intent,1); it is just for checking the results you can read more about request codes in the android developer site
I opened native camera in android device as follows :
I want to open a Native Camera of the Android Device with the default setting FOCUS_MODE_MACRO. I tried and search for that but i am not getting proper solution for that.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
So, anybody can help me to solve this issue. is there any parameter which i need to put in intent or is there any other solution?
Thanks in advance.
Regards
http://code.google.com/p/zxing/downloads/list
This camera is a bit irrelevant, but on the events of the inspection of the project have a good idea, perhaps useful for class
Now I have downloaded a .pdf file from website and wanna open it with the specified software like "Adobe Reader".How can I achieve this?
You cant. All you can do is fire off an intent and let the system handle it. If the user already has a default app that they've chosen to handle PDFs, that's the one that will open the PDF.
In general it's something like:
File file = new File("/sdcard/example.pdf");
if (file.exists()) {
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
} .......
I have solved this problem by adding the method "Intent.setComponent(pkg,cls);".
PS: I don Not angry about downing my reps.And thank you for giving me the suggestions.
PSS: What I wanna say is "Not everyone will get the same apple." I post this question for I have this problem and it occured in Android App.And Someone told me "Cannot".I post my answer just to tell you Ive solved this(or just mine) problem,and maybe it will help someone who has the problem same as mine.Yeah,this answer may make no sense to you.
PSSS::-)But I still think the API make sense to me and to its Designer.
*PSSSS:*At last,thank you all.And forgive my poor English.
You should first have a look at the intents filters documentation. Then you can start an intent (after adding the intent filter) for your PDF file.
I am developing a new application which hopefully will use a barcode reader to scan and find books. I will then use the ISBN information to get more information.
The intents work and I can scan 2d barcodes ok but not the 1d barcodes of books which I know scan fine using the full application.
This is my code. I have tried it without putting the intent extras and it doesn't change anything.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "ONE_D_MODE");
startActivityForResult(intent, 0);
Is there something obvious I am missing? The settings in the app also are selected on 1d scanning only.
Thanks
Turns out that using product mode worked perfectly. I don't know why I didn't try that earlier!
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
(Probably easiest if I answer in just one place: http://code.google.com/p/zxing/issues/detail?id=574 )