summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-09-24 09:55:58 -0400
committer Android (Google) Code Review <android-gerrit@google.com> 2009-09-24 09:55:58 -0400
commita7beb95ede9700b1f206ffa571c205c9b7e68539 (patch)
tree2949ce22cbfbee6c2487ec58be89454b4e23174c
parentd421995fdb490c687d27b56aa89bc83afc7c3d06 (diff)
parent354eb66673bbf7a6251583c135d13bcc2c62af0b (diff)
Merge change 26818 into eclair
* changes: Add possibility to customize the chooser dialog used to allow the user to choose the application for sharing a link.
-rw-r--r--core/java/android/provider/Browser.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index 92bc8142dea2..028d3d7b2d09 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -174,13 +174,29 @@ public class Browser {
}
public static final void sendString(Context c, String s) {
+ sendString(c, s,
+ c.getText(com.android.internal.R.string.sendText).toString());
+ }
+
+ /**
+ * Find an application to handle the given string and, if found, invoke
+ * it with the given string as a parameter.
+ * @param c Context used to launch the new activity.
+ * @param stringToSend The string to be handled.
+ * @param chooserDialogTitle The title of the dialog that allows the user
+ * to select between multiple applications that are all capable of handling
+ * the string.
+ * @hide pending API council approval
+ */
+ public static final void sendString(Context c,
+ String stringToSend,
+ String chooserDialogTitle) {
Intent send = new Intent(Intent.ACTION_SEND);
send.setType("text/plain");
- send.putExtra(Intent.EXTRA_TEXT, s);
-
+ send.putExtra(Intent.EXTRA_TEXT, stringToSend);
+
try {
- c.startActivity(Intent.createChooser(send,
- c.getText(com.android.internal.R.string.sendText)));
+ c.startActivity(Intent.createChooser(send, chooserDialogTitle));
} catch(android.content.ActivityNotFoundException ex) {
// if no app handles it, do nothing
}