What's the “dot” for when registering an Activity

前端 未结 3 1396
温柔的废话
温柔的废话 2020-11-29 04:24

I\'m kind of a noob at programming for the Android OS. I noticed in the books I have been reading that the authors have placed a \"dot\" in front of the activity name when

3条回答
  •  孤独总比滥情好
    2020-11-29 05:04

    As you have noticed the point is not necessary but it basically means: the activity class lives in the same package of the app. So, if your app package is: com.my.package then:

    • .YourActivity means that your class is inside com.my.package.
    • YourActivity means that your class is inside com.my.package (same as above).
    • .activities.YourActivity means that your class is inside com.my.package.activitites.
    • You can even do something like: com.my.package.activities.YourActivity which is useful when you want to have different versions of your app and use Ant to change the references to the package automatically.

提交回复
热议问题