这是否正确:
public class DetailsFragment extends Fragment {
private final Intent intent = getActivity().getIntent();
// use intent here and there
}
我知道在 servlet 中必须等待 init() 获得可用的上下文。android中的情况是什么?我们必须在 中做这样的事情OnCreate
吗?作为一个附加问题 - 这种使用 final 字段是否令人不悦?它会破坏生命周期吗?
欢迎链接:)