添加其他库崩溃其他库

时间:2013-09-18 09:18:16

标签: android android-library

我尝试将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吗?

1 个答案:

答案 0 :(得分:1)

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

查看此问题以获取更多信息switch case statement error: case expressions must be constant expression