定义启动活动在code的装填前活动 [英] Define Launcher Activity In Code Before Activities Loaded

查看:83
本文介绍了定义启动活动在code的装填前活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以设置在manifest文件中您的应用程序的发射活动,但有反正你可以静态为此在code中的活动由Dalvik虚拟机加载之前?是这样的:

I realise you can set the LAUNCHER activity of your app in the manifest file, but is there anyway you can statically do this in code before the activity is loaded by the Dalvik VM? Something like:

    public class MyActivity extends Activity{

      RunTime.LAUNCHER = MyActivity.class
      ...

}

我知道这也许是不可能的,但如果是我会AP preciate安全可靠code例子来实现这一目标?

I realise this might not be possible, but if it is I would appreciate a safe and reliable code example to achieve this?

非常感谢

推荐答案

什么是可能的,但是,是有启动你需要的任何旁边活动第一个空活动,但不显示自己。

What is possible, however, is to have a first empty activity that starts whatever activity you need next, without displaying itself.

public void onCreate(Bundle stuff) {
    super.onCreate(stuff);
    startActivity(new Intent(...whatever...);
    finish();
}

这篇关于定义启动活动在code的装填前活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆