package com.hoytgm;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.View.OnClickListener;
import android.util.Log;
/**
* single activity class, run single native application.
*/
public class hoytgm extends Activity implements SurfaceHolder.Callback {
private static String TAG = "### hoytgm: ";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate()");
android.view.WindowManager.LayoutParams WMLP = getWindow().getAttributes();
WMLP.width = 640;
WMLP.height = 480;
getWindow().setAttributes(WMLP);
setContentView(R.layout.main);
SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceview);
surfaceView.getHolder().addCallback(this);
surfaceView.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
}
});
}
public static void exit() {
System.exit(0);
}
@Override
protected void onStart() {
super.onStart();
Log.i(TAG, "onStart()");
nativeOnStart();
}
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume()");
nativeOnResume();
}
@Override
protected void onPause() {
super.onPause();
Log.i(TAG, "onPause()");
nativeOnPause();
}
@Override
protected void onStop() {
super.onStop();
Log.i(TAG, "onStop()");
nativeOnStop();
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Log.i(TAG, "surfaceChanged()");
nativeSetSurface(holder.getSurface());
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated()");
}
public void surfaceDestroyed(SurfaceHolder holder) {
nativeSetSurface(null);
}
public static native void nativeOnStart();
public static native void nativeOnResume();
public static native void nativeOnPause();
public static native void nativeOnStop();
public static native void nativeSetSurface(Surface surface);
static {
System.loadLibrary("hoytgm");
}
}