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

前端 未结 7 1239
爱一瞬间的悲伤
爱一瞬间的悲伤 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 02:11

    dot means your package name. It's more short type of declaration.

    If you define a subclass, as you almost always would for the component classes (Activity, Service, BroadcastReceiver, and ContentProvider), the subclass is declared through a name attribute. The name must include the full package designation. For example, an Service subclass might be declared as follows:

    
         
             
                 . . .
             
             . . .
          
    
    

    However, as a shorthand, if the first character of the string is a period, the string is appended to the application's package name (as specified by the element's package attribute). The following assignment is the same as the one above:

    
         
             
                 . . .
             
             . . .
          
     
    

    When starting a component, Android creates an instance of the named subclass. If a subclass isn't specified, it creates an instance of the base class.

    http://developer.android.com/guide/topics/manifest/manifest-intro.html Declaring class names

提交回复
热议问题