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

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


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:

<manifest . . . >     <application . . . >         <service android:name="com.example.project.SecretService" . . . >             . . .         </service>         . . .     </application> </manifest>

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:

<manifest package="com.example.project" . . . >     <application . . . >         <service android:name=".SecretService" . . . >             . . .         </service>         . . .     </application> </manifest> 

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


yes putting the dot is right way..if you see the eclipse self generated activity it looks like.

 <activity         android:name=".MyFirstActivity"         android:label="@string/app_name">    </activity>

so its the right approach, our ide can understand


Using relative paths is fine.
The path is separated by a dot, rather than a slash.

android:name=".one_path_level_down.MainActivity"android:name=".one_path_level_down.DetailActivity"

The top level is the package level in your manifest file in the "package=". Something like the following:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.abc.myapp1" >