public static Bitmap bmp;
bmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.nehe);
the error for above code "Syntax error on token ";", , expected" I already put a semi colon after bmp
but still the error occurs
here is the full code:
public class CustomActivity extends AndARActivity {
ARToolkit artoolkit;
CustomObject someObject;
CustomObject1 someObject1;
public static Bitmap bmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.nehe);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CustomRenderer renderer = new CustomRenderer();
super.setNonARRenderer(renderer);
try {
//register a object for each marker type
artoolkit = super.getArtoolkit();
someObject = new CustomObject
("test", "androidpirate.patt", 80.0, new double[]{0,0});
artoolkit.registerARObject(someObject);
someObject = new CustomObject
("test", "andson.patt", 80.0, new double[]{0,0});
artoolkit.registerARObject(someObject);
someObject1 = new CustomObject1("test","andrev.patt", 80.0, new double[]{0,0});
artoolkit.registerARObject(someObject1);
someObject1 = new CustomObject1("test","androidpat.patt", 80.0, new double[]{0,0});
artoolkit.registerARObject(someObject1);
} catch (AndARException ex){
//handle the exception, that means: show the user what happened
System.out.println("");
}
startPreview();
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.e("AndAR EXCEPTION", ex.getMessage());
finish();
}
}
You are calling "this" in a static context, "this" refers to the class instance object, therefore using it in a static manner is not a valid Java syntax. Additionally, I don't think "this.getResources()" would return anything but null until the time onCreate(Bundle) method is called.
You should do something like: