What's the correct syntax to define an activity in manifest file

前端 未结 7 1227
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 01:22

What is the correct way of adding an activity to AndroidManifest.xml?

Actually I have seen in many places an activity defined as



        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 01:57

    http://developer.android.com/guide/topics/manifest/activity-element.html#nm

    android:name
    The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name
    

    (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the .

    So given ApplicationManifest.xml:

    ...

    then since android:name=".view.TaskListListView" has a leading period, so it is interpreted as android:name="com.stackoverflow.android.geotask.view.TaskListListView".

    source

提交回复
热议问题