search

Home  >  Q&A  >  body text

android - 如何在一个Module中调用另一个module中的Activity?

如题。在不添加依赖的情况下该如何在一个Module中调用另一个module中的Activity?
使用:

Intent intent = new Intent("myAction");
        intent.setClassName("packageName", "packageName+ActivityName");
        startActivity(intent);

会出现

android.content.ActivityNotFoundException: Unable to find explicit activity class 

求大神赐教!

PHPzPHPz2772 days ago1123

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:34:16

    If you don’t add dependencies, your module will not be compiled into your app. How can you find it? Obviously that's not possible.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:34:16

    Obviously you can’t do this, you can’t find it. Use implicit calls.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:34:16

    1. There is a way to solve it. Using routing, all activities are registered in a routing table, and one key corresponds to one activity
    2. Jump through the routing tool class

    reply
    0
  • Cancelreply