彩信附件添加删除
添加附件。
在ComposeMessageActivity里
addAttachment(int type) 函数
根据type的不同,分成6个case
case A:
MediaSelectListActivity.ADD_IMAGE 用gallery选图片:
MessageUtils.selectImage(this, REQUEST_CODE_ATTACH_IMAGE);
起一个intent:
public static void resizeImageAsync(final Context context, final Uri imageUri, final Handler handler, final ResizeImageResultCallback cb, final boolean append) { // Show a progress toast if the resize hasn't finished // within one second. // Stash the runnable for showing it away so we can cancel // it later if the resize completes ahead of the deadline. final Runnable showProgress = new Runnable() { public void run() { Toast.makeText(context, R.string.compressing, Toast.LENGTH_SHORT).show(); } }; // Schedule it for one second from now. handler.postDelayed(showProgress, 1000); new Thread(new Runnable() { public void run() { final PduPart part; try { UriImage image = new UriImage(context, imageUri); part = image.getResizedImageAsPart(MmsConfig .getMaxImageWidth(), MmsConfig.getMaxImageHeight(), MmsConfig.getMaxMessageSize() - MESSAGE_OVERHEAD); } finally { // Cancel pending show of the progress toast if necessary. handler.removeCallbacks(showProgress); } handler.post(new Runnable() { public void run() { cb.onResizeResult(part, append); } }); } }).start(); }