How to start an activity in an android Application from the Library

后端 未结 4 568
眼角桃花
眼角桃花 2021-02-11 07:24

I have an Android application in Android Studio. And I\'ve added a library into the application. The button, view, and activities are defined in the library. When I click on the

4条回答
  •  温柔的废话
    2021-02-11 08:05

    Include the activity in AndroidManifest.xml.

    To access an activity from any other project the easiest way is to pass the whole class name (including package, e.g; "com.myproject.MainActivitiy")

    Calling from your library :

     Intent intent= new Intent("com.myproject.MainActivitiy");
     startActivity(intent);
    

    And in your project manifest declare it like this

               
                
                    
                    
                
            
    

提交回复
热议问题