@string/app_name in the AndroidManifest.xml can be found from the file strings.xml as below.
Other than using an id such as app_name in a layout file to find a string, the developers can simply replace it by the string “Database Example.”
| SQLiteDemo/app/src/main/res/values/strings.xml |
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Database Example</string> </resources> |
R.java, which is no longer generated by the Android Studio.
There are two ways to refer the resources specified in the directory res/:TestDatabase.java displays the screen specified in the file res/layout/main.xml:setContentView( R.layout.main );
res/layout/main.xmlapp_name specified in the file res/values/strings.xml:android:label="@string/app_name"
| generated/source/r/debug/com/example/wenchen/sqlitedemo/R.java |
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.wenchen.SQLiteDemo;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int add=0x7f050001;
public static final int delete=0x7f050002;
public static final int group=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
|
|
I was playing chess with my friend and he said, “Let’s make this interesting.” So we stopped playing chess. — Matt Kirshen |