TA的每日心情 | 开心 2012-3-7 10:15 |
---|
签到天数: 11 天 [LV.3]偶尔看看II
|
[代码] [Java]代码
private boolean handleSendIntent(Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null) {
return false;
}
final String mimeType = intent.getType();
String action = intent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
if (extras.containsKey(Intent.EXTRA_STREAM)) {
Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
boolean wildcard = "*/*".equals(mimeType);
if (mimeType.startsWith("image/") || (wildcard && uri.toString().startsWith(mImageUri))) {
setAttachment(1,uri, true);
} else if (mimeType.startsWith("video/") || (wildcard && uri.toString().startsWith(mVideoUri))) {
setAttachment(2,uri, true);
}
//addAttachment(mimeType, uri, false);
return true;
} else if (extras.containsKey(Intent.EXTRA_TEXT)) {
MessageText.setText(extras.getString(Intent.EXTRA_TEXT));
return true;
}
Toast.makeText(this, getString(R.string.message_too_big_for_video), Toast.LENGTH_SHORT).show();
}
|
|