开发者

How to change text when scanning barcodes with Zxing via intent in Android?

Is it possible to change the prompt text that says "place the bar开发者_开发问答code inside the viewfinder..." when launching the Barcode scanner (zxing) via intent ?

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

I want to have a prompt in my language, how should I do that?


Yes, plain and simple:

intent.putExtra("PROMPT_MESSAGE", "Your Text Here");


If it's worth to anyone, here's how you do it with IntentIntegrator if you decided to import ZXings libraries to Android Studio:

integrator.addExtra("PROMPT_MESSAGE", "Your message here");


Developer here. No sorry you can't do that. But yes if all you mean is you want to contribute a new translation, send us the text.


It reads "Positionieren Sie den Barcode innerhalb des Rechtecks" on my Android. So I guess, the text depends on the handhelds locale setting (as ZXing doesn't provide a setting to change the locale locally).

So if you need support for a now unsuported language, I bet you have to get in contact with ZXings dev team.


The proper and modern way to do it is

IntentIntegrator scanIntent = new IntentIntegrator(this);
scanIntent.setPrompt("TEXT THAT YOU WANT TO SHOW");


With this work perfectly 'cause i'm using it integrator.setPrompt("Here your text");

and then....when you clicked (mean on result....) you can change the prompt to retry or continue...in this way:

builder.setTitle("Scan Result");
builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
          // here your new intent or other...like blabla();
    }
}).setNegativeButton("Retry",new  DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
         //even here new itent like  blablabla();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜