What is a "point" when registering activity

I am somehow a programmer for Android for Android. I noticed that in the books I read, the authors put an end to the name of the activity when registering their activity in the manifest. I looked at the Android developer site and I can’t understand why we need a β€œdot”. Does the dot really use the server? Do I need this? I gave an example below. Note the "dot" before the "NewActivity":

<activity android:name=".NewActivity"></activity> 
+48
android android-manifest
Jan 28 2018-11-11T00:
source share
3 answers

As you noticed, the item is not needed, but basically it means: the activity class lives in one application package. So, if your application package is: com.my.package , then:

  • .YourActivity means your class is inside com.my.package .
  • YourActivity means your class is inside com.my.package (as above).
  • .activities.YourActivity means 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 application and use Ant to automatically change package links.
+40
Jan 28 2018-11-11T00:
source share

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

Android: name
The name of the class that implements the action, a subclass of Activity. The attribute value must be a fully qualified class name (for example, "com.example.project.ExtracurricularActivity"). However, as an abbreviation, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is added to the package name specified in <manifest> .

So, ApplicationManifest.xml is set:

 <manifest ... package="com.stackoverflow.android.geotask" ...> <application ...> <activity android:name=".view.TaskListListView" ...> ... </application> </manifest> 

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

+26
Jan 29 2018-11-11T00:
source share

This point will add your package to your application manifest.

If your package name is com.app.demo .

 <activity android:name=".HelloWorldActivity"> 

This means that the Activity is inside the demo package.

You can replace this with

 <activity android:name="com.app.demo.HelloWorldActivity"> 
+2
Jun 30 '16 at 7:17
source share