Zxing:Activity get Result

karaova

New Member
I've making my own app, with a menu and in one activity iam trying to get the result of a qrcode.I need to get the IntentResult but how? And where I get the onActivityResult working?Its a litle confuse, this via intent.How can I implement a function to get the text to a string?Truly thankful.RMCActivity:\[code\]public class Authentication extends Activity { TextView showResults; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //Load file xml setContentView(R.layout.authentication); //To create start button Button scan = (Button) findViewById(R.id.btnStartAuth); scan.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { IntentIntegrator integrator = new IntentIntegrator(Authentication.this); integrator.initiateScan(); } }); //HERE I NEED TO GET THE VALUE OF THE QR CODE WITH MY ONACTIVITYRESULT // BUT WHERE I GET THE //PROTOTYPE VALUES? } //end_of_onCreate // functions public void getResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); EditText showResults = (EditText) findViewById(R.id.txtviewResultados); showResults.setText(contents); } else if (resultCode == RESULT_CANCELED) { // Every time I receive this code showResults.setText("Error reading: result null"); } } } }//end_of_activity\[/code\]`
 
Top