我遇到的问题onActivityCreated()是在调用activity的onStart()方法后调用我的片段方法.这似乎意味着我的活动的onCreate()方法正在完成之后onStart()?情况不是这样......可以吗?在我的活动的生命周期中,我的片段onActivityCreated()被称为?此外,如果我有多个片段,我如何控制片段onActivityCreated()调用的顺序?
在我的活动中:
@Override
protected void onStart() {
super.onStart();
methodA(); // this is called ...
}
Run Code Online (Sandbox Code Playgroud)
在我的片段中:
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
methodB(); // ... before this
}
Run Code Online (Sandbox Code Playgroud) java android android-lifecycle android-fragments android-activity
我有三个班:Foo,Bar和Baz.Bar和Baz都扩展了Foo,这是抽象的.我有一个类型Foo的列表,充满了酒吧和Bazes.我想使用LINQ Where子句返回所有类型.就像是:
class Bar : Foo
{
public Bar()
{
}
}
class Baz : Foo
{
public Baz()
{
}
}
List<Foo> foos = new List<Foo>() { bar1, bar2, foo1, foo2, bar3 };
List<Bar> bars;
bars = (List<Bar>)foos.Where(o => o.GetType() == Type.GetType("Bar"));
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我收到一个错误:附加信息:无法转换'WhereListIterator 1[Foo]' to type 'System.Collections.Generic.List1 [Bar]' 类型的对象.
有没有办法在系统文件资源管理器的左侧"文件夹"栏中打开文件或文件夹?如果没有这个,我必须打开文件资源管理器并一直导航到这个文件夹的任何地方,以便操作文件,这真的很不方便.对于大多数带有这样的导航栏的工具来说,这是一个标准功能,如果在ST中无法实现这一点,我会感到非常惊讶.