5条以上数据信息如何生成二维码
How do i generate QR code with more than 5 data information
问题是,当我尝试将我的字符串放入 qrgEncoder = new QRGEncoder 时,它总是出错,我知道这是错误的,因为我需要将我的所有字符串放在一个字符串或散列中,但我不知道如何将我的哈希.!非常感谢您的回复,先生,谢谢您的预付款
firstname = findViewById(R.id.firstname);
phone = findViewById(R.id.phone);
address = findViewById(R.id.address);
qr = findViewById(R.id.qr);
btn = findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String first = firstname.getText().toString().trim();
String phones = phone.getText().toString().trim();
String textaddress = address.getText().toString().trim();
if(first.length() > 0 || phones.length() > 0 || textaddress.length() > 0) {
WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point point = new Point();
display.getSize(point);
int width = point.x;
int height = point.y;
int smallerDimension = width < height ? width : height;
smallerDimension = smallerDimension * 3 / 4;
qrgEncoder = new QRGEncoder(
first,phones,textaddress, null,
QRGContents.Type.TEXT,
smallerDimension);
try {
bitmap = qrgEncoder.encodeAsBitmap();
qr.setImageBitmap(bitmap);
} catch (WriterException e) {
Log.v(TAG, e.toString());
}
}
}
});
}
}
如果我查看您的代码以及如何 QRGEncoder implementations,我想您需要先连接字符串输入,然后再将其添加到其构造函数中。
因此,你应该这样称呼它:
StringBuilder qrParam = new StringBuilder();
qrParam.append(first);
qrParam.append(phones);
qrParam.append(textaddress);
qrgEncoder = new QRGEncoder(
qrParam.toString(),
null,
QRGContents.Type.TEXT,
smallerDimension);
问题是,当我尝试将我的字符串放入 qrgEncoder = new QRGEncoder 时,它总是出错,我知道这是错误的,因为我需要将我的所有字符串放在一个字符串或散列中,但我不知道如何将我的哈希.!非常感谢您的回复,先生,谢谢您的预付款
firstname = findViewById(R.id.firstname);
phone = findViewById(R.id.phone);
address = findViewById(R.id.address);
qr = findViewById(R.id.qr);
btn = findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String first = firstname.getText().toString().trim();
String phones = phone.getText().toString().trim();
String textaddress = address.getText().toString().trim();
if(first.length() > 0 || phones.length() > 0 || textaddress.length() > 0) {
WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point point = new Point();
display.getSize(point);
int width = point.x;
int height = point.y;
int smallerDimension = width < height ? width : height;
smallerDimension = smallerDimension * 3 / 4;
qrgEncoder = new QRGEncoder(
first,phones,textaddress, null,
QRGContents.Type.TEXT,
smallerDimension);
try {
bitmap = qrgEncoder.encodeAsBitmap();
qr.setImageBitmap(bitmap);
} catch (WriterException e) {
Log.v(TAG, e.toString());
}
}
}
});
}
}
如果我查看您的代码以及如何 QRGEncoder implementations,我想您需要先连接字符串输入,然后再将其添加到其构造函数中。
因此,你应该这样称呼它:
StringBuilder qrParam = new StringBuilder();
qrParam.append(first);
qrParam.append(phones);
qrParam.append(textaddress);
qrgEncoder = new QRGEncoder(
qrParam.toString(),
null,
QRGContents.Type.TEXT,
smallerDimension);