Using an Android library project Activity within another project

前端 未结 8 1381
余生分开走
余生分开走 2020-11-30 01:37

I have an Android library project that I would like to use from within another Android project.

The library has a Activity declared in its AndroidManifest. When I t

8条回答
  •  自闭症患者
    2020-11-30 02:32

    When using an activity inside the library, the activity should be declared only inside the manifest of library. The activity can be started from the main app like this:

      Intent intent = new Intent();
            intent.setClassName(this, "com.duna.remotelocklibrary.activities.MainRemoteActivity");
            startActivity(intent);
    

    I tried to start the library's activity like the following code, but i warn you: it doesn't work

      Intent intent = new Intent();
            intent.setClassName("com.duna.remotelocklibrary", "com.duna.remotelocklibrary.activities.MainRemoteActivity");
            startActivity(intent);
    

提交回复
热议问题