简体   繁体   English

从另一个不显示活动但正在运行的应用程序启动活动

[英]Launching activity from another application not displaying the activity, but it is running

I've done a lot of searching for the last day and haven't found anything that seems to match the problem I'm having. 我已经做了很多寻找最后一天的事情,却没有发现任何与我遇到的问题匹配的东西。

(For reasons I won't go into) the app is divided into two separate apks. (出于我不愿讨论的原因),该应用程序分为两个单独的apk。 Each have activities. 每个都有活动。 Only the "core" apk has a MAIN activity that is launched from the Android Launcher. 只有“核心” apk才具有从Android启动器启动的MAIN活动。 The "plugin" apk has activities that only exist to be called from the first apk's activities and does not have a Launcher icon. “插件” apk具有只能从第一个apk的活动中调用的活动,并且没有启动器图标。

The issue I'm having is that when I create an intent to launch an activity from the "plugin" apk, it does the "launching new activity" sliding animation but immediately bounces back. 我遇到的问题是,当我创建意图从“插件” apk启动活动时,它会执行“启动新活动”滑动动画,但会立即反弹。 But it is actually launching the activity because I'm seeing log statements in logcat coming from the new activity. 但这实际上是在启动活动,因为我看到logcat中的日志语句来自新活动。 I'm not getting any exceptions and it seems to be working other than the fact I'm not seeing the activity on the screen. 我没有任何异常,除了我没有在屏幕上看到活动之外,它似乎正在工作。

I've tried creating the intent in both of the following ways: 我尝试通过以下两种方式创建意图:

Intent myIntent = new Intent(Intent.ACTION_VIEW);
myIntent.setClassName("com.test.plugin", "com.test.plugin.PluginActivity");
startActivity(myIntent);

and

Intent myIntent = new Intent();
myIntent.setComponent(new ComponentName("com.test.plugin", "com.test.plugin.PluginActivity"));
startActivity(myIntent);

But both result in the same thing happening as described above. 但是,两者都会导致如上所述发生相同的事情。

它反弹回来意味着插件活动在启动时有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM