The following code is eclipse successful execution, XE5 how to write,
Public void onClick (View v) {
//call the corresponding scan method
Intent Intent=new Intent (" com. Google. Zxing. Client. Android. SCAN ");
Enclosing startActivityForResult (intent, 0);
}
Protected void onActivityResult (int requestCode, int the resultCode, Intent Intent) {
If (requestCode!=0) {
return;
}
If (the resultCode==RESULT_OK) {
The String contents=intent. GetStringExtra (" SCAN_RESULT ");
String format=intent. GetStringExtra (" SCAN_RESULT_FORMAT ");
//edit_sku setText ());
TextView. SetText (" bar code is: "+ contents +" bar code type is: "+ format).//use page textveiw shows the result of scanning after} else if (the resultCode==RESULT_CANCELED) {
}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- here are XE5 code,
Procedure TForm1. Button2Click (Sender: TObject);
Var
Uri: Jnet_Uri;
Intent: JIntent;
RIntent: JIntent;
The begin
Intent:=TJIntent. JavaClass. Init (StringToJString (' com. Google. Zxing. Client. Android. SCAN '));
SharedActivity. StartActivityForResult (Intent, 0);
Edit1. Text:=JStringtoString (Intent. GetStringExtra (StringToJString (' SCAN_RESULT)));
end;
Can call the barcode scanner, but after the scan can't get barcode number,
CodePudding user response:
No one with XE5???CodePudding user response:
XE5 trial, however, still feeling not Java to use, recommended or use Java do it,