0

Good day. I'm trying to create tabbed application (via TabHost), tab bar with icons should be available at all time. However one of my activities implements ZBar component. The recommend way of usage is via intent:

Intent intent = new Intent(this, ZBarScannerActivity.class);
startActivityForResult(intent, ZBAR_SCANNER_REQUEST);

But in this case camera preview just fills the whole available surface. How do I run this component in some frame? I suppose I can try to do that via WebView, but I can't figure out how to get scanning result in that case.

user475255
  • 89
  • 1
  • 9

1 Answers1

1

A WebView? No, that's a bad idea.

You can just call tabHost.setContent(intent); and add the intent.

startActivityForResult() just opens a new Activity window so don't even use that.

Example:

tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("HOME")
.setContent(new Intent(this,ZBarScannerActivity.class)));
Edward van Raak
  • 4,841
  • 3
  • 24
  • 38
  • Thanks this helps, however I can't recieve scanning result this way. Application just quits on code recognition. – user475255 Mar 12 '13 at 08:43
  • How are you trying to receive the scanning results? What error are you getting? – Edward van Raak Mar 12 '13 at 11:36
  • Aww nevermind, I took another way - not ZBarScannerActivity but base camera control class. So I can call my own activity from TabHost with methods of that class. Thanks for help! – user475255 Mar 15 '13 at 13:55