QR CODE - 如何?
QR CODE - how to?
我想隐藏二维码中的结果...
例如:?re=123456789012&rr=
我只想显示 123456789012 并隐藏 ?re= 和 &rr
我在看书,有人说使用 Split 方法,对吗?
protected void onActivityResult(int requestCode,int resultCode,Intent data){
IntentResult result = IntentIntegrator.parseActivityResult(requestCode,resultCode,data);
if(result != null){
if(result.getContents()==null){
Toast.makeText(this,"cancelled", Toast.LENGTH_LONG).show();
}
else{
resultado.setText(result.getContents());
}
}
else {
super.onActivityResult(requestCode,resultCode,data);
}
}
尝试使用子字符串函数:-
function
:-
private String getQR(String content)
{
return content.substring(4,15);
}
function implementation
:-
if(result.getContents()==null){
Toast.makeText(this,"cancelled", Toast.LENGTH_LONG).show();
}
else{
resultado.setText(getQR(result.getContents())); // <- <-
}
我想隐藏二维码中的结果... 例如:?re=123456789012&rr= 我只想显示 123456789012 并隐藏 ?re= 和 &rr 我在看书,有人说使用 Split 方法,对吗?
protected void onActivityResult(int requestCode,int resultCode,Intent data){
IntentResult result = IntentIntegrator.parseActivityResult(requestCode,resultCode,data);
if(result != null){
if(result.getContents()==null){
Toast.makeText(this,"cancelled", Toast.LENGTH_LONG).show();
}
else{
resultado.setText(result.getContents());
}
}
else {
super.onActivityResult(requestCode,resultCode,data);
}
}
尝试使用子字符串函数:-
function
:-
private String getQR(String content)
{
return content.substring(4,15);
}
function implementation
:-
if(result.getContents()==null){
Toast.makeText(this,"cancelled", Toast.LENGTH_LONG).show();
}
else{
resultado.setText(getQR(result.getContents())); // <- <-
}