Android 注释属性不接受我的变量
我现在读了很多关于这方面的文章,我发现了一些例子,说明了如何使用较新的ADT的switch语句来获得常量表达式,但是没有提到@Inject 下面是我的问题代码的一个示例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; @
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语义。有关更多信息,请参阅。