语法错误,行上有多个标记

时间:2013-03-26 13:28:08

标签: android syntax-error android-camera

ImageView ivCamera;

FlashLightControl = (Button)findViewById(R.id.flashcontrol);
ivCamera = (ImageView)findViewById(R.id.iv_camera);

Syntax error on token ";" ,, expected.


- Multiple markers at this line
- Syntax error on token ")", { expected after    this token
- Syntax error, insert ";" to complete       FieldDeclaration
- Syntax error on token ".", ... expected
- Return type for the method is missing

Syntax error, insert "}" to complete MethodBody

2 个答案:

答案 0 :(得分:0)

您需要为FlashLightControl变量命名:

FlashLightControl flc = (Button)findViewById(R.id.flashcontrol);
ivCamera = (ImageView)findViewById(R.id.iv_camera);

另一方面,Button可以被视为FlashLightControl个实例吗?

也许你想要

Button flashLightControl = (Button)findViewById(R.id.flashcontrol);

答案 1 :(得分:0)

您似乎缺少对象引用。请更改以下代码行:

FlashLightControl = (Button)findViewById(R.id.flashcontrol);

对此:

FlashLightControl flashControlName = (Button)findViewById(R.id.flashcontrol);

但是,只有当FlashLightControl属于Button类型或与其兼容时才会有效。

希望这有帮助。