小编Lea*_*ros的帖子

捕获Android MediaPlayer错误

我想抓住像这样的MediaPlayer错误:

01-03 21:03:08.797: E/MediaPlayer(9470): error (1, -2147483648)
Run Code Online (Sandbox Code Playgroud)

或这个

01-03 20:52:48.859: E/MediaPlayer(8674): error (1, -1004)
Run Code Online (Sandbox Code Playgroud)

我需要捕获哪个例外?我试过了

    try {
        mp.start();
    }

    catch (IllegalArgumentException e){Log.d(TAG, "error1");}
    catch (IllegalStateException e) {Log.d(TAG, "error2");}
    catch (Exception e){Log.d(TAG, "error2");}
Run Code Online (Sandbox Code Playgroud)

但它不起作用.谁能告诉我哪个例外我必须抓到?

android media-player

1
推荐指数
1
解决办法
2657
查看次数

Git删除提交但不删除更改

我意外地提交了很多,我添加了更改并希望这样做,git commit -m "foo"但我错误输入了我并输入了git commit -a -m "foo".

如何在不丢失我所做的更改的情况下还原这个?

git

1
推荐指数
1
解决办法
134
查看次数

为什么允许空声明?

为什么C允许空声明?语法级别都明确允许它们使用,并且仅在编译时才生成警告。

生产declaration,从C标准的附件A中,允许它在语法级别:

declaration
    = declaration_specifiers , ";"
    | declaration_specifiers , init_declarator_list , ";"
    | static_assert_declaration
    ;
Run Code Online (Sandbox Code Playgroud)

EBNF由我变成)

c language-lawyer

1
推荐指数
1
解决办法
125
查看次数

如果和elseif不工作

对于凌乱的代码很抱歉,但基本上这个代码只会生成$booktype = "ICT",如果我从elseif中删除"else",它会使它相等ENGLISH.

什么出错了?

我回应了POST_ Book room,结果很好.

if ($_POST['bookroom'] == "142" || "040" || "139"|| "104") {
    $booktype = "ICT";
} elseif ($_POST['bookroom'] == "015" || "016" || "017" || "018" || "027" || "028") {
    $booktype = "MATHS";
} elseif ($_POST['bookroom'] == "E03") {
    $booktype = "MUSIC";
} elseif ($_POST['bookroom'] == "202" || "204" || "205" || "206" || "207") {
    $booktype = "ENGLISH";
}
Run Code Online (Sandbox Code Playgroud)

php

-1
推荐指数
1
解决办法
78
查看次数

标签 统计

android ×1

c ×1

git ×1

language-lawyer ×1

media-player ×1

php ×1