Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 注释属性不接受我的变量_Android_Eclipse_Google Api - Fatal编程技术网

Android 注释属性不接受我的变量

Android 注释属性不接受我的变量,android,eclipse,google-api,Android,Eclipse,Google Api,我现在读了很多关于这方面的文章,我发现了一些例子,说明了如何使用较新的ADT的switch语句来获得常量表达式,但是没有提到@Inject 下面是我的问题代码的一个示例 import roboguice.inject.InjectView; public abstract class YpListActivity extends GuiceListActivity @InjectView(R.id.btnSearch) Button btnSearch; @

我现在读了很多关于这方面的文章,我发现了一些例子,说明了如何使用较新的ADT的switch语句来获得常量表达式,但是没有提到@Inject

下面是我的问题代码的一个示例

 import roboguice.inject.InjectView;
 public abstract class YpListActivity extends GuiceListActivity 

     @InjectView(R.id.btnSearch)
     Button btnSearch;
     @InjectView(R.id.btnSpeech)
     View btnSpeech;
     @InjectView(R.id.etWhat)
     EditText etWhat;
     @InjectView(R.id.etWhere)
     EditText etWhere;
     @InjectView(R.id.tvIn)
     TextView tvIn;
     @InjectView(R.id.tvLocation)
     TextView tvLocation;
     @InjectView(R.id.tvCustom)
     private ToggleButton tvCustom;
     @InjectView(R.id.infoButton)
     private ImageView iconButton;
每次我尝试使用@injectView(R.id.*)之类的东西时,eclipse都会抛出错误:

“注释属性InjectView.value的值必须是常量表达式。”

我甚至试着把它改成这样:

     private static final int btnsrch = new Integer(R.id.btnSearch);

     @InjectView(btnsrch )
     TableRow btnSearch ;
“btnsrch”怎么不是一个常量表达式


有人知道如何解决这个问题吗?

删除“private”,它应该可以正常工作。

我想更改Java语义。有关更多信息,请参阅。