summaryrefslogtreecommitdiffstats
path: root/apps/Development
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-02-17 12:34:48 -0800
committerBrian Carlstrom <bdc@google.com>2011-04-08 11:12:58 -0700
commit1dadaee6ce6c1edbab0247a9b72a1818cb5b428f (patch)
treeff7d45eae5c0e5b29e20fbe49d24530e934e7852 /apps/Development
parent1710677cba88977d2fbd9f8c2455ec6f1d0ae11f (diff)
downloadandroid_development-1dadaee6ce6c1edbab0247a9b72a1818cb5b428f.tar.gz
android_development-1dadaee6ce6c1edbab0247a9b72a1818cb5b428f.tar.bz2
android_development-1dadaee6ce6c1edbab0247a9b72a1818cb5b428f.zip
Tolerate missing AccountManager resource, not just missing resource name
Change-Id: I3885d7f8a66868cd2ca5f463d427b891548cf22f
Diffstat (limited to 'apps/Development')
-rw-r--r--apps/Development/src/com/android/development/AccountsTester.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/Development/src/com/android/development/AccountsTester.java b/apps/Development/src/com/android/development/AccountsTester.java
index e2a0789b8..b4155e792 100644
--- a/apps/Development/src/com/android/development/AccountsTester.java
+++ b/apps/Development/src/com/android/development/AccountsTester.java
@@ -21,6 +21,7 @@ import android.app.Dialog;
import android.app.AlertDialog;
import android.content.*;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.accounts.*;
import android.os.Bundle;
import android.os.Parcelable;
@@ -32,6 +33,8 @@ import android.util.Log;
import android.text.TextUtils;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
public class AccountsTester extends Activity implements OnAccountsUpdateListener {
private static final String TAG = "AccountsTester";
@@ -142,7 +145,7 @@ public class AccountsTester extends Activity implements OnAccountsUpdateListener
private void initializeAuthenticatorsSpinner() {
mAuthenticatorDescs = mAccountManager.getAuthenticatorTypes();
- String[] names = new String[mAuthenticatorDescs.length];
+ List<String> names = new ArrayList(mAuthenticatorDescs.length);
for (int i = 0; i < mAuthenticatorDescs.length; i++) {
Context authContext;
try {
@@ -150,12 +153,17 @@ public class AccountsTester extends Activity implements OnAccountsUpdateListener
} catch (PackageManager.NameNotFoundException e) {
continue;
}
- names[i] = authContext.getString(mAuthenticatorDescs[i].labelId);
+ try {
+ names.add(authContext.getString(mAuthenticatorDescs[i].labelId));
+ } catch (Resources.NotFoundException e) {
+ continue;
+ }
}
+ String[] namesArray = names.toArray(new String[names.size()]);
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(AccountsTester.this,
- android.R.layout.simple_spinner_item, names);
+ android.R.layout.simple_spinner_item, namesArray);
mAccountTypesSpinner.setAdapter(adapter);
}