我有两节课,第一节课用来叫第二节课
头等舱
public boolean onOptionsItemSelected(MenuItem item) {
Log.i(TAG, "Menu Item selected " + item);
if (item == A) {
SecondClassVariabel.setViewMode(SecondClass.Object_1);
} else if (item == B) {
SecondClassVariabel.setViewMode(SecondClass.Object_2);
}
二等
public SecondClass(Context context) {
super(context);
Holder = getHolder();
Holder.addCallback(this);
Log.i(TAG, "Instantiated new " + this.getClass());
SecondClassVariabel = Object_1;
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated");
(new Thread(this)).start();
}
protected Bitmap processFrame(byte[] data) {
mYuv.put(0, 0, data);
final int viewMode = Tampilan;
switch (viewMode) {
case Object_1:
/** Call another sub class */
break;
case Object_2:
/**Call another sub class */
break;
==================================================== ===========================
上面的程序已经成功运行,现在我正在尝试自动调用“Object_1”和“Object_2”..
*fyi = 要调用 object_1 和 object_2,我使用按钮。
我想添加线程函数或延迟函数先调用object_1,然后调用object_2,而不使用按钮。
编码...
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated");
(new Thread(this)).start();
然后(new Thread(this)).sleep(5000);
//for object_1 然后(new Thread(this)).sleep(5000);
//for object_2 }
我对使用延迟或线程功能的以下步骤感到困惑..请帮助..