英文:
What happens first: onCreate or configureFlutterEngine?
问题
onCreate
和 configureFlutterEngine
中哪一个会首先发生,我需要明确这一点:
我在这里:
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
我必须确切地知道哪一个会首先被调用,而不仅仅是打印出来看。
英文:
I need to know which one of these happens first:
onCreate
or configureFlutterEngine
?
I'm in
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
and I need to be certain of which one is called first. I must know it for sure, not simply print and see.
答案1
得分: 1
-
在 onCreate 方法之前
-
关于 configureFlutterEngine 的详细信息,请参阅
https://api.flutter.dev/javadoc/io/flutter/embedding/android/FlutterActivity.html
> public void configureFlutterEngine(@NonNull FlutterEngine
> flutterEngine)
>
> 用于子类轻松配置 FlutterEngine 的钩子,例如注册插件。
>
> 此方法在 provideFlutterEngine(Context) 之后调用。
英文:
-
onCreate first
-
about configureFlutterEngine see
https://api.flutter.dev/javadoc/io/flutter/embedding/android/FlutterActivity.html
> public void configureFlutterEngine(@NonNull FlutterEngine
> flutterEngine)
>
> Hook for subclasses to easily configure a FlutterEngine, e.g., register > plugins.
>
> This method is called after provideFlutterEngine(Context).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论