动态创建活动创建活动、动态

2023-09-12 22:14:53 作者:平平淡淡の17年

我要动态地创建活动。是这样的:

I want to create an activity dynamically. Something like:

Activity a = new Activity();

这可能吗?我是否需要特殊的权限?或者是根本不可能的?

Is it possible ? Do I need a special permission ? Or is it simply not possible ?

错误我得到:我没有得到任何异常,但是当我尝试使用此指令的程序停止

The error I get: I don't get any exception but the program stops when I try to use this instruction.

推荐答案

您不能实例化一个活动,如果它不是在清单中,因此你不能创建一个动态的。

You can't instantiate an Activity if it's not in the Manifest, so you can't create one dynamically.