Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the "dot" for when registering an Activity

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 registering their activities in the manifest. I've looked around the Android developer site and I can't figure out why we need the "dot". Does the "dot" actually server a purpose? Do I need it? I have included an example below. Notice the "dot" before "NewActivity":

<activity android:name=".NewActivity"></activity> 
like image 558
Cavachon Avatar asked Jan 28 '11 23:01

Cavachon


People also ask

How do you declare activity?

To declare your activity, open your manifest file and add an <activity> element as a child of the <application> element. For example: <manifest ... > The only required attribute for this element is android:name, which specifies the class name of the activity.

What is activity tag?

Activity tags are snippets of JavaScript code that contain an HTML image tag. The image tag sends a request to Ad Manager and records an activity event. You can use Ad Manager reporting to understand conversion metrics for activity groups and activities.


1 Answers

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.
like image 182
Cristian Avatar answered Sep 21 '22 17:09

Cristian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!