cj
unread,Feb 24, 2012, 3:17:11 AM2/24/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zxing
Hi there, I've been using the android SDK for a whole 2 hrs so please
bear with me if I dont quite understand what I'm doing.
So I've created a little app, with one activity, that contains some
text boxes and two buttons, each where I wanted to using zxing to do
that scanning. So i implemented first button, textbox, used the
intentintegrator, worked great. I now wanted to add a second button,
but here is where I dont get it, since I cannot tell the difference
between which button was pressed, both will just call the one event
onActivityResult. Is this just a caveat, and I'll probably need to
import all of the source of zxing, since my needs will not work with
intents?
here is the simple little app so far.
package com.example.helloandroid;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void doWOScan(View view) {
IntentIntegrator.initiateScan(this);
}
public void doTaskScan(View view) {
IntentIntegrator.initiateScan(this);
}
public void onActivityResult(int requestCode, int resultCode,
Intent intent) {
IntentResult scanResult =
IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
Toast.makeText(this, scanResult.getContents() ,
Toast.LENGTH_SHORT).show();
}
// else continue with any other code you need in the method
}
}
Thanks,
Cameron