Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

answered someones question
Source Link
user316117
  • 8.4k
  • 22
  • 92
  • 166

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.

EDIT: Someone asked what happens if I delete that line. If I delete that line it moves the same error message up to the closing paren on the previous line, i.e., "_8888); "

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.

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.

EDIT: Someone asked what happens if I delete that line. If I delete that line it moves the same error message up to the closing paren on the previous line, i.e., "_8888); "

Source Link
user316117
  • 8.4k
  • 22
  • 92
  • 166

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

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.

lang-java

AltStyle によって変換されたページ (->オリジナル) /