Archived: Redefine Text in Resource Files

This section describes how the text message string of the TextView gets redefined in the resource file, main.xml.

This tutorial was based on Android SDK R17 with Android 4.0.3 and left here as a reference.

In the previous tutorial, I noticed that the text message string defined the Java source file gets redefined by the resource file. Now I want to modify the resource file and rebuild HelloAnroid to display the original text message.

1. Keep the Android emulator running.

2. Uninstall HelloAndroid from the emulator using the Ant tool:

C:\herong\HelloAndroid>\local\apache-ant-1.8.3\bin\ant uninstall
Buildfile: C:\herong\HelloAndroid\build.xml

     [echo] Uninstalling com.herongyang from the default emulator ...
     [exec] Success

Total time: 9 seconds

3. Modify the resource file, .\res\layout\main.xml, to remove the line android:text="Hello World, HelloAndroid":

<?xml version="1.0" encoding="utf-8"?>

4. Rebuild HelloAndroid using the Ant tool:

C:\herong\HelloAndroid>\local\apache-ant-1.8.3\bin\ant debug

5. Reinstall HelloAndroid using the Ant tool:

C:\herong\HelloAndroid>\local\apache-ant-1.8.3\bin\ant installd

6. Run HelloAndroid again on the emulator. This time, the test string, "Hello, Android", from the Java source code is displayed:
HelloAndroid Application Rebuild

Now I am happy. I get the exact test message as entered in the Java source code.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

Archived Tutorials

 Archived: Downloading and Installing JDK 1.7

 Archived: Downloading and Installing Android SDK R17

 Archived: Running Android SDK Manager

 Archived: Installing Android Platform 4.0.3 and Libraries

 Archived: Verifying Android Platform Installation

 Archived: Creating Android Virtual Device (AVD)

 Archived: Launching Android Emulator in AVD Manager

 Archived: Android Emulator Built-in Applications

 Archived: Android Emulator Built-in Web Browser

 Archived: Downloading and Installing Apache Ant 1.8

 Archived: "HelloAndroid" - First Android Project

 Archived: Building the Debug Binary Package

 Archived: Installing the Debug Binary Package

 Archived: Running the Debug Binary Package

 Archived: Rebuild the Debug Binary Package

Archived: Redefine Text in Resource Files

 Archived: Installing Android PDF Viewer APK File

 Archived: Copy PDF File to Android Emulator's File System

 Archived: Installing Adobe Reader APK File

 Archived: "adb shell" - Remote Shell Interface

 Archived: "adb push" and "adb pull" Commands


 Full Version in PDF/EPUB