I want to use this lib: https://code.google.com/p/barcodefraglibv2/
But I can't figure out how to add BarcodeFragment in code. Here's a sample:
public class MainActivity extends Activity implements IScanResultHandler{
BarcodeFragment fragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fragment = new BarcodeFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.sample, fragment).commit();
fragment.setScanResultHandler(this);
}
}
But I've got an error here:
ft.add(R.id.sample, fragment).commit();
The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, BarcodeFragment)
Thank you.