I’ve just started android learning recently, and I’m trying to write one program, but always have different mistakes, so I’ve tried to rewrite it and get yet another mistake and the very beginning of it. I know that this question is “newby”, but if you could help me it would be great. aso, here is the deal: it’s kinda a game, and I create class extended from SurfaceView and which implements SurfaceHolder.Callback and a thread where could I do all the stuff, but though thread’s start method do nothing, I catch an error.
Here is my project: https://dl.dropbox.com/u/22326796/Aquarium.7z
And here is some basic code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.skeeve.aquarium.AquariumView
android:id="@+id/aquarium"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/aquarium"/>
</FrameLayout>
public class AquariumView extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder surfaceHolder;
private AquariumManager manager;
public AquariumView(Context context) {
super(context);
surfaceHolder = getHolder();
surfaceHolder.addCallback(this);
manager = new AquariumManager(surfaceHolder, context);
}
public class AquariumActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
}
}
Your error is in your constructor (AquariumView.java)
change :
by: