【发布时间】:2015-03-04 00:35:02
【问题描述】:
我想在单击按钮后保存创建的位图
我怎样才能做到这一点?如果可能的话,到一个特定的位置
这是我的代码:
quoteimage.requestLayout();
if (quoteimage.getViewTreeObserver().isAlive()) {
quoteimage.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
// we check which build version we are using
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
quoteimage.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
quoteimage.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
viewToBitmap(quoteimage); ///this one creates the bitmap
}
});
}
share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
///Here I want to save the bitmap
}
});
【问题讨论】:
-
@NoMoreHelloWorld "你看过了吗"***** 是的,我看过
标签: android bitmap onclick save fileoutputstream