开发者

Checkbox for sharing feature

How开发者_运维知识库 to extend the sharing feature with checkbox for default app?

here is my code:

    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, developers);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);

and the screencast herefor (without checkbox):

Checkbox for sharing feature

I want to make posible to set one app as default app.


workaround:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:" + developers[0]));
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, developers);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
activity.startActivity(emailIntent);

the line:

emailIntent.setData(Uri.parse("mailto:" + developers[0]));


Looking around I found this piece of documentation about the Intent flag ACTION_CHOOSER: http://developer.android.com/reference/android/content/Intent.html#ACTION_CHOOSER

Here it states that:

This can be used as an alternative to the standard activity picker that is displayed by the system when you try to start an activity with multiple possible matches, with these differences in behavior: You can specify the title that will appear in the activity chooser. The user does not have the option to make one of the matching activities a preferred activity, and all possible activities will always be shown even if one of them is currently marked as the preferred activity.

The text in bold says that the system displays a checkbox by default unless otherwise specified by the developer, for example by using the flag ACTION_CHOOSER.

I don't know why your system does something else.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜