diff options
author | John Reck <jreck@google.com> | 2011-09-22 15:54:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-22 15:54:24 -0700 |
commit | faf4e0f84f76d590f297496b6d7a14a11cbba72f (patch) | |
tree | 9c404e76ad16d6f2d19962075e2b43738a2465fd | |
parent | b99d2d01d1a5ea003d76979ca50f1fe2b12e688d (diff) | |
parent | 1b7d2b95670a6c94cb29e0f4b965cebdf6f65bda (diff) | |
download | packages_apps_Browser-faf4e0f84f76d590f297496b6d7a14a11cbba72f.zip packages_apps_Browser-faf4e0f84f76d590f297496b6d7a14a11cbba72f.tar.gz packages_apps_Browser-faf4e0f84f76d590f297496b6d7a14a11cbba72f.tar.bz2 |
Merge "Fix Resources.getIdentifier usage"
-rw-r--r-- | src/com/android/browser/homepages/RequestHandler.java | 3 | ||||
-rw-r--r-- | src/com/android/browser/homepages/Template.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/search/SearchEngineInfo.java | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/browser/homepages/RequestHandler.java b/src/com/android/browser/homepages/RequestHandler.java index 248bf53..e0a0eac 100644 --- a/src/com/android/browser/homepages/RequestHandler.java +++ b/src/com/android/browser/homepages/RequestHandler.java @@ -115,7 +115,8 @@ public class RequestHandler extends Thread { void writeResource(String fileName) throws IOException {
Resources res = mContext.getResources();
- int id = res.getIdentifier(fileName, null, mContext.getPackageName());
+ String packageName = R.class.getPackage().getName();
+ int id = res.getIdentifier(fileName, null, packageName);
if (id != 0) {
InputStream in = res.openRawResource(id);
byte[] buf = new byte[4096];
diff --git a/src/com/android/browser/homepages/Template.java b/src/com/android/browser/homepages/Template.java index c1a6b0e..e918b07 100644 --- a/src/com/android/browser/homepages/Template.java +++ b/src/com/android/browser/homepages/Template.java @@ -30,6 +30,8 @@ import android.content.res.Resources; import android.database.Cursor;
import android.util.TypedValue;
+import com.android.browser.R;
+
public class Template {
private static HashMap<Integer, Template> sCachedTemplates = new HashMap<Integer, Template>();
@@ -234,7 +236,7 @@ public class Template { private static String replaceConsts(Context context, String template) {
final Pattern pattern = Pattern.compile("<%@\\s*(\\w+/\\w+)\\s*%>");
final Resources res = context.getResources();
- final String packageName = context.getPackageName();
+ final String packageName = R.class.getPackage().getName();
Matcher m = pattern.matcher(template);
StringBuffer sb = new StringBuffer();
while (m.find()) {
diff --git a/src/com/android/browser/search/SearchEngineInfo.java b/src/com/android/browser/search/SearchEngineInfo.java index af6fa70..ec304f6 100644 --- a/src/com/android/browser/search/SearchEngineInfo.java +++ b/src/com/android/browser/search/SearchEngineInfo.java @@ -21,6 +21,8 @@ import android.content.res.Resources.NotFoundException; import android.text.TextUtils; import android.util.Log; +import com.android.browser.R; + import java.net.URLEncoder; import java.util.Arrays; import java.util.Locale; @@ -61,7 +63,8 @@ public class SearchEngineInfo { mName = name; Resources res = context.getResources(); - int id_data = res.getIdentifier(name, "array", context.getPackageName()); + String packageName = R.class.getPackage().getName(); + int id_data = res.getIdentifier(name, "array", packageName); if (id_data == 0) { throw new IllegalArgumentException("No resources found for " + name); } |