Firstly, thank you to everyone involved in this project - amazing work!
I had a problem getting the lesson 08 example working, kept getting an NullPointerException on loading the resource:
(...)
public void loadGLTexture(GL10 gl, Context context) {
//Get the texture from the Android resource directory
InputStream is = context.getResources().openRawResource(l.werner.livewallpaper.hypnoclockgl.R.drawable.nehe_android);
Bitmap bitmap = null;
try {
//BitmapFactory is an Android graphics utility for images
bitmap = BitmapFactory.decodeStream(is);
} finally {
//Always clear and close
try {
is.close();
is = null;
} catch (IOException e) {
}
}
(...)
I found that the easiest way to fix this nullpointerexception is to modify the constructor in MyWallpaperService.MyEngine to include
renderer.setContext(getApplicationContext());
Full method:
public MyEngine()
{
super();
// handle prefs, other initialization
renderer = new MyRenderer();
setRenderer(renderer);
setRenderMode(RENDERMODE_CONTINUOUSLY);
renderer.setContext(getApplicationContext());
}
Hello,
Firstly, thank you to everyone involved in this project - amazing work!
I had a problem getting the lesson 08 example working, kept getting an NullPointerException on loading the resource:
(...) public void loadGLTexture(GL10 gl, Context context) { //Get the texture from the Android resource directory InputStream is = context.getResources().openRawResource(l.werner.livewallpaper.hypnoclockgl.R.drawable.nehe_android); Bitmap bitmap = null; try { //BitmapFactory is an Android graphics utility for images bitmap = BitmapFactory.decodeStream(is);
(...)
I found that the easiest way to fix this nullpointerexception is to modify the constructor in MyWallpaperService.MyEngine to include
renderer.setContext(getApplicationContext());
Full method: public MyEngine() { super(); // handle prefs, other initialization renderer = new MyRenderer(); setRenderer(renderer); setRenderMode(RENDERMODE_CONTINUOUSLY); renderer.setContext(getApplicationContext()); }
Anyways, hope this helps someone!
Thanks again to Mark F Guerra and Robert Green!
LW