buaa21/summer2020

安卓程序保存图片问题

Closed this issue · 0 comments

private Handler mHandler = new Handler() { @Override public void handleMessage(final Message msg) { mIv.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { savedia = new Dialog(MainContext, R.style.SaveImageDialog); savedia.setContentView(R.layout.save_dialog); savedia.setCanceledOnTouchOutside(true); savedia.show(); Button SaveBtn = (Button) savedia.findViewById(R.id.SaveImageTextView); SaveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // System.out.println(msg.obj.toString()); ImageSave((Bitmap) msg.obj); } }); return true; } }); switch (msg.what) { case 1: mIv.setImageBitmap((Bitmap) msg.obj); break; } } };
通过上述代码发现创建的button onclick监听事件之中,图片为空,保存的图片为空,
然而swith中的设置图片显示却是正常显示,这是为什么