在ZXing项目的切换例机器人错误 [英] Error in Switch cases of ZXing project in android
问题描述
我已经下载从<一个的ZXing项目href="http://$c$c.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q=">http://$c$c.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q=而随后的<一个所有步骤href="http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/">http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/.
I have downloaded the ZXing project from the http://code.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q= and followed all the steps of http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/.
但我的ZXing项目给错误的ZXing库的开关情况。
But my ZXing project is giving error in switch cases of ZXing Library.
误差在以下code
private final Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
switch (message.what) {
case R.id.search_book_contents_succeeded:
handleSearchResults((JSONObject) message.obj);
resetForNewQuery();
break;
case R.id.search_book_contents_failed:
resetForNewQuery();
headerView.setText(R.string.msg_sbc_failed);
break;
}
}
};
误差在switch语句 错误是情况下,前pressions必须是恒定的前pressions
error is in switch statement error is "case expressions must be constant expressions"
你知道吗? Thanxs
Any Idea ? Thanxs
推荐答案
您需要的情况下语句转换成if语句如果编译zxing作为一个库。选择在Eclipse并使用Ctrl + 1的文字,让月食为你做这个。
You need to convert the case statements to if statements if you compile zxing as a library. Select the text in eclipse and use ctrl+1 to let eclipse do this for you.
这篇关于在ZXing项目的切换例机器人错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!