Android Tutorials - Herong's Tutorial Examples - v3.03, by Herong Yang
Outdated: 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 uninstall: [echo] Uninstalling com.herongyang from the default emulator ... [exec] Success BUILD SUCCESSFUL 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"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>
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:
Now I am happy. I get the exact test message as entered in the Java source code.
Table of Contents
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
AboutAndroid - Application to Retrieve System Information
android.app.Activity Class and Activity Lifecycle
View Objects and Layout Resource Files
Using "adb logcat" Command for Debugging
Build Process and Package File Content
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet
USB Debugging Applications on LG-P925g Phone
Outdated: Downloading and Installing JDK 1.7
Outdated: Downloading and Installing Android SDK R17
Outdated: Running Android SDK Manager
Outdated: Installing Android Platform 4.0.3 and Libraries
Outdated: Verifying Android Platform Installation
Outdated: Creating Android Virtual Device (AVD)
Outdated: Launching Android Emulator in AVD Manager
Outdated: Android Emulator Built-in Applications
Outdated: Android Emulator Built-in Web Browser
Outdated: Downloading and Installing Apache Ant 1.8
Outdated: "HelloAndroid" - First Android Project
Outdated: Building the Debug Binary Package
Outdated: Installing the Debug Binary Package
Outdated: Running the Debug Binary Package
Outdated: Rebuild the Debug Binary Package
►Outdated: Redefine Text in Resource Files
Outdated: Installing Android PDF Viewer APK File
Outdated: Copy PDF File to Android Emulator's File System
Outdated: Installing Adobe Reader APK File
Outdated: "adb shell" - Remote Shell Interface