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

后端 未结 4 596
不思量自难忘°
不思量自难忘° 2021-02-11 07:22

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 07:52

    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

               
                
                    
                    
                
            
    

提交回复
热议问题