0

我尝试将 facebookSDK 库添加到我的项目中,但一切都崩溃了。首先出现我有3个版本的问题android-support-v4.jar,所以我从我的项目中复制了文件并将其粘贴到其他2个方向。然后我遇到了操作栏按钮的问题,就像这些库有问题一样,我删除了所有文件并再次添加它。

现在我在每种情况下都有错误

public boolean onOptionsItemSelected(MenuItem item)
{ 
    Intent  intent;
    switch (item.getItemId())
    {
 here ->    case R.id.Choice1:
        intent= new Intent(this, Chooser.class);

        startActivity(intent);

        return true;

就像他没有看到菜单中的项目一样。我还要加android-support-v4.jar一次吗?

4

1 回答 1

1

用 if/else 替换 switch/case 语句。如果您在 Eclipse 中,您只需单击开关,然后按 CTRL+1。

检查此问题以获取更多信息switch case 语句错误:case 表达式必须是常量表达式

于 2013-09-18T10:20:34.657 回答