IntentIntegrator
protected void onCreate(Bundle savedInstanceState) { <br>
super.onCreate(savedInstanceState);<br>
setContentView(R.layout.activity_main);<br>
new IntentIntegrator(this).initiateScan();<br>
}
onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) { <br>
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);<br>
if (scanResult != null) {<br>
TextView t = (TextView) findViewById(R.id.textView2);<br>
String data[] =scanResult.getContents().split("\n");<br>
for(String k:data){<br>
t.append(k+"\n");<br>
}<br>
}<br>
}
In this, I got the data using the getContents method and split this data string. Then we added this data to textview2
source
share