【发布时间】:2014-10-03 13:02:12
【问题描述】:
我正试图找出我的视图注入可能有什么问题。 它适用于我的应用程序中的片段,但我似乎无法让它适用于活动。 这是我的代码:
@ContentView(R.layout.schedule)
public class ScheduleActivity extends RoboFragmentActivity{
@InjectView(R.id.train_list_holder) ListView mViewTrainListContainer;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
CL.v(String.valueOf(mViewTrainListContainer));
}
}
mViewTrainListContainer 的值始终为空。
【问题讨论】:
-
你能添加你的布局xml吗?
-
本打算复制我的布局,但发现了我的问题。我有 LinearLayout 而不是 ListView。奇怪的是它不会抛出任何 Cast 异常。它只是将我的 var 设置为 null。
标签: java android dependency-injection roboguice