图片压缩 - sinothk/ImageHelper GitHub Wiki
单图
ImageCompress.execute(outfile1.getPath(), new CompressCallback() {
@Override
public void compressed(Object obj) {
if (obj == null) {
return;
}
String newPath = (String) obj;
textView1.setText(newPath);
}
});
多图
String[] pathArr = new String[3];
pathArr[0] = outfile1.getPath();
pathArr[1] = outfile2.getPath();
pathArr[2] = outfile3.getPath();
ImageCompress.execute(pathArr, new CompressCallback() {
@Override
public void compressed(Object obj) {
if (obj == null) {
Log.e("a", "a=" + "compress bitmap failed!");
} else {
final String[] ps = ((String[]) obj);
String content = "";
for (int i = 0; i < ps.length; i++) {
content += ps[i] + ", ";
}
Log.e("压缩结果:", "path = " + content);
textView2.setText(content);
}
}
});