Too many Activities in Android?

后端 未结 6 1955
春和景丽
春和景丽 2021-02-13 14:24

When i started my Android project i had a misunderstanding that every screen that\'s shown in the application must be a new activity. Now i am finished with the project , i have

6条回答
  •  感动是毒
    2021-02-13 14:57

    If your project has many activities but some activity is not important,it means that you do not need any activity after another activity start.

    In manifest file set : android:noHistory="true"

    Example:

    Activity1 -> Activity2 -> Activity3 -> Activity4..................-> Activity20
    

    In manifest file:

      activity android:name=".Activity1" android:label="@string/app_name" android:noHistory="true"
    

    if u call again Activity1 using Intent than set finish() before startActivity()

    I think this can help you

提交回复
热议问题