Android : Can't see what's causing this Java syntax error

on Friday, April 17, 2015


I'm making a Java class in Eclipse Indigo for an Android project. (I'll be fleshing this class out with some 2D graphics eventually). I'm getting...



Syntax error, insert “;” to complete Statement



on the setBitmap call near the end - the compiler is putting the red line showing the error under the closing paren after 'bitmap'. This is the entire file . . .



package com.ag.testlayout;

import android.view.WindowManager;
import android.view.Window;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.view.View;


public class MyGraphicsView extends View {

private Canvas canvas;
private Bitmap bitmap;

public MyGraphicsView(Context context) {
super(context);
}

@Override
protected void onSizeChanged(int curw, int curh, int oldw, int oldh) {
if (bitmap != null) {
bitmap.recycle();
}
canvas= new Canvas();
bitmap = Bitmap.createBitmap(curw, curh, Bitmap.Config.ARGB_8888);
canvas.setBitmap(bitmap);
}
}


I looked for mismatched braces and parens and couldn't see any, but I hope the problem is obvious to someone here.


0 comments:

Post a Comment