Call method on activity load, Android [closed]

依然范特西╮ 提交于 2019-11-30 15:38:37

You can use the following method

You can call your method in between any one of them on Activity startup all these are called where as onResume is called every time activity resumes it is well explained in ActivityLifeCycle Diagram

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);   

}


@Override
protected void onStart()
{   
    // TODO Auto-generated method stub
    super.onStart();
}


@Override
protected void onResume()
{   
    // TODO Auto-generated method stub
    super.onResume();
}

You can learn more from here

You can learn more from ActivityLifeCycle

or follow this ActivityLifeCycle

You have to call the method in the onCreate() method. The onCreate() method is called when the activity is first created. Check out the Activity lifecycle:

You can view the activity timeline Here, and check out the startActivity() function Here.

Hopefully these two will lead you in the right direction for your situation. Good luck.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!