i'm new to Android apps. I'm trying to create a barcode scanner, but the result does not appear in my edittext
.
Also, in the onActivityResult
the following error is shown:
The method onActivityResult(int, int, Intent) from the type new View.OnClickListener(){} is never used locally
I have the class intentIntegrator
and IntentResult
in my project.
This a part of my code:
BtnBar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {;
if (resultCode == Activity.RESULT_OK && requestCode == 0) {
Bundle extras = data.getExtras();
String result = extras.getString("SCAN_RESULT");
EditText desc = (EditText) findViewById(R.produto.desc);
desc.setText(result);
}
desc.setText(resultCode);
}
//public void onActivityResult(int requestCode, int resultCode, Intent intent) {
}
);
This is the XML code for the button:
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+produto/desc"
android:enabled="false"
/>
<requestFocus />