diff --git a/mobile/.idea/misc.xml b/mobile/.idea/misc.xml
index 062c409c..4742f8a1 100644
--- a/mobile/.idea/misc.xml
+++ b/mobile/.idea/misc.xml
@@ -3,13 +3,6 @@
-
-
-
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentAdapter.java b/mobile/src/com/cradle/iitc_mobile/share/IntentAdapter.java
index 3c3cde4a..fe6c26c1 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentAdapter.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentAdapter.java
@@ -36,7 +36,12 @@ class IntentAdapter extends ArrayAdapter {
final Intent item = getItem(position);
- view.setText(IntentGenerator.getTitle(item));
+ try {
+ view.setText(IntentGenerator.getTitle(item));
+ } catch (IllegalArgumentException e) {
+ view.setText("unknown");
+ Log.w(e);
+ }
view.setCompoundDrawablePadding((int) getContext().getResources().getDimension(R.dimen.icon_margin));
// get icon and scale it manually to ensure that all have the same size
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentComparator.java b/mobile/src/com/cradle/iitc_mobile/share/IntentComparator.java
index 8e0dead9..34b5560f 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentComparator.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentComparator.java
@@ -78,9 +78,12 @@ public class IntentComparator implements Comparator {
if (lCount < rCount) return 1;
// still no order. fall back to alphabetical order
- order = IntentGenerator.getTitle(lhs).compareTo(IntentGenerator.getTitle(rhs));
- if (order != 0) return order;
-
+ try {
+ order = IntentGenerator.getTitle(lhs).compareTo(IntentGenerator.getTitle(rhs));
+ if (order != 0) return order;
+ } catch(IllegalArgumentException e) {
+ Log.w(e);
+ }
order = lComponent.getPackageName().compareTo(rComponent.getPackageName());
if (order != 0) return order;
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentGenerator.java b/mobile/src/com/cradle/iitc_mobile/share/IntentGenerator.java
index 218ae7a3..8d331712 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentGenerator.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentGenerator.java
@@ -34,9 +34,8 @@ public class IntentGenerator {
}
}
- public static String getTitle(final Intent intent) {
- if (intent.hasExtra(EXTRA_FLAG_TITLE))
- return intent.getStringExtra(EXTRA_FLAG_TITLE);
+ public static String getTitle(final Intent intent) throws IllegalArgumentException {
+ if (intent.hasExtra(EXTRA_FLAG_TITLE)) return intent.getStringExtra(EXTRA_FLAG_TITLE);
throw new IllegalArgumentException("Got an intent not generated by IntentGenerator");
}