I built an android application with Xamarin Studio using a library named barcodefraglibv2 and i found a problem with reading of code bar because when the library launch the camera then the library don't have a camera with automatic focus so the code bar is not understandable. I will want to know how fix this problem, maybe exist some option for change the clarity of camera. The test i did do with another device with 5MP and happened the same problem This is the fragment that use this library
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.content.BroadcastReceiver;
import android.support.v4.content.LocalBroadcastManager;
import com.abhi.barcode.frag.libv2.BarcodeFragment;
import com.abhi.barcode.frag.libv2.IScanResultHandler;
import com.abhi.barcode.frag.libv2.ScanResult;
public class ScanActivity extends FragmentActivity implements IScanResultHandler {
private BarcodeFragment fragment;
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
finish();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan);
fragment = (BarcodeFragment)getSupportFragmentManager().findFragmentById(R.id.Scanner);
fragment.setScanResultHandler(this);
fragment.setFrontCamera(false);
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("SCAN_ACTION"));
}
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
super.onPause();
}
@Override
public void scanResult(ScanResult result) {
Intent intent = new Intent("SCAN_RESULT");
intent.putExtra("Code", result.getRawResult().getText());
sendBroadcast(intent);
}
}
0 comments:
Post a Comment