在创建活动对象时的onCreate叫什么名字? [英] Is onCreate called when an Activity object is created?
本文介绍了在创建活动对象时的onCreate叫什么名字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在创建一个类的对象,扩展活动时的onCreate叫什么名字?抑或是只有当一个活动是叫的开始的,例如在startActivity(...)。
Is onCreate called when a class object that extends activity is created? Or is it only called when an activity is started, for example over startActivity(...).
推荐答案
要回答你的问题,为扩展活动的一类,如果你试图实例化活动通过正常的手段(MyActivity MA =新MyActivity();)的的onCreate()方法将不会被调用。只有当你的意图启动活动将在方法被调用。
To answer you question, for a class that extends activity, if you try to instantiate that Activity by normal means ( MyActivity ma = new MyActivity(); ) the onCreate() method WILL NOT be called. Only if you start the Activity with an intent will the method be called.
这篇关于在创建活动对象时的onCreate叫什么名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文