Renaming Parts of an Application

Sometimes a portion of an Android project needs to be renamed. Maybe a file was copied manually into the project, such as from this book. Maybe the application name has changed during development, and it needs to be reflected in the filesystem tree. Automatic tools help with this and ensure cross-references are automatically updated. For example, in the Eclipse IDE, the different ways to rename portions of an application are

■ Rename the Android project, as follows:

1. Right-click the project and Refactor ^ Move to a new directory in the filesystem.

2. Right-click the project and Refactor ^ Rename the project.

■ Rename an Android package, as follows:

1. Right-click the package and Refactor ^ Rename the package.

2. Edit the AndroidManifest.xml to ensure the new package name is reflected.

■ Rename an Android class (such as the major components Activity, Service, BroadcastReceiver, ContentProvider), as follows:

1. Right-click the .java file and Refactor ^ Rename the class.

2. Edit the AndroidManifest.xml to ensure the android:name has the new component name.

Note that renaming other files, such as XML files, usually requires manually changing the corresponding references in the Java code.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment