[英]How to set value edittext from barcode scanner result
i want to send my value barcodescanner to myedittext我想将我的价值条码扫描仪发送到 myedittext
this code for scanner result此代码用于扫描仪结果
class ZXingScannerResultHandler implements ZXingScannerView.ResultHandler{
@Override
public void handleResult(Result result){
String resultCode = result.getText();
setContentView(R.layout.activity_buat_biodata);
scannerView.stopCamera();
}
}
and this for edittext这用于edittext
ton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbHelper.getWritableDatabase();
db.execSQL("insert into biodata(no, nama, tgl, jk, alamat) values('" +
text1.setText(resultCode) + "','" +
text2.getText().toString() + "','" +
text3.getText().toString() + "','" +
text4.getText().toString() + "','" +
text5.getText().toString() + "')");
Toast.makeText(getApplicationContext(), "Berhasil", Toast.LENGTH_LONG).show();
MainActivity.ma.RefreshList();
finish();
}
});
After getting the result code to:得到结果代码后:
String resultCode
Just do the following:只需执行以下操作:
text1.setText(resultCode)
Just pass the result from scanner using intent or bundle (I can't figure out whether you are using an activity or fragment) to the next activity/fragment.只需使用 Intent 或 bundle(我无法确定您使用的是活动还是片段)将扫描仪的结果传递给下一个活动/片段。 Then use setText() to assign value to your editText.然后使用 setText() 为您的 editText 赋值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.