First of all, I read through all those topics how to use Zxing in Java but always got errors with missing com.google.zxing.client.j2se.* (I loaded the zxing core-3.2.1.jar in eclipse and all other zxing packages work unless j2se) or just found solutions for creating qr images...
My aim is to write one single method which gets an image file finds the qr code in this image, decodes the qr code and returns the string, basically it should be something like the following:
import com.google.zxing.*;
public class QRCode {
/*
* ...
*/
public String getDecodedString(SomeStandardImageType photo){
// detect the qr code in a photo
// create qr image from detected area in photo
// decode the new created qr image and return the string
return "This is the decoded dataString from the qr code in the photo";
}
}
To sum up the method should get an image file like the following
and should return the url or if failed just "".
The code should be compatible with Zxing 3.2.1.
Edit: The question is solved. For others who are interested in this I want to say that it is important to add both external jars core-3.2.1.jar
and javase-3.2.1.jar
to external jars. The answer by me works without the latter but depends on android image libs.