我最近刚开始学习android,我正在尝试编写一个程序,但总是有不同的错误,所以我试图重写它并得到另一个错误和它的开头。我知道这个问题是“新手”,但如果你能帮助我,那就太好了。aso,这就是交易:它有点像一个游戏,我创建了从 SurfaceView 扩展的类,它实现了 SurfaceHolder.Callback 和一个我可以做所有事情的线程,但是虽然线程的 start 方法什么都不做,但我发现了一个错误。这是我的项目:https ://dl.dropbox.com/u/22326796/Aquarium.7z 这是一些基本代码:
<?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);
}
}