小编Bra*_*ntz的帖子

如何修复java.io.NotSerializableException:android.graphics.Bitmap

您好我试图将图像位置保存到sreen到内部存储但是我得到一个NotSerializableException.我去搜索并发现问题是Bitmap不是为了在这个链接上 序列化问题序列化Drawable我从来没有真正理解他如何修复问题抛出这个例子.如果有人可以解释他如何修复他的NotSerializableException并帮助我与我的相处,我将不胜感激


这是我的Elememt课程

public class Element extends main implements Serializable{
private int mX;
private int mY;
int location2 ;
Matrix elementlocation;
private Bitmap mBitmap;
Canvas canvas2;

public Element(Resources res, int x, int y) {
  location2 =item3;
    mBitmap = BitmapFactory.decodeResource(res, location2);
    mX = x - mBitmap.getWidth() / 2;
    mY = y - mBitmap.getHeight() / 2;
  }

public Element(){

}
public void doDraw2(Canvas canvas) {
    elementlocation=new Matrix();
    elementlocation.postTranslate(mX,mY);
    canvas2=canvas;
    canvas2.drawBitmap(mBitmap, elementlocation,null);
    }
public void setelementlocation(float num1,float num2){
   elementlocation=new Matrix();
   elementlocation.postTranslate(num1,num2);
 } …
Run Code Online (Sandbox Code Playgroud)

android serializable

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

serializable ×1