如果我在onCreate()中添加while循环
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gx__smart_player);
GX_FullscreenConfigure();
// Get the input parameters, e.g. sourcePath.
Bundle bundle = this.getIntent().getExtras();
strSourcePath = bundle.getString("address");
if(strSourcePath != ""){
String sdcardPath = Environment.getExternalStorageDirectory().getPath();
strSourcePath = sdcardPath + strSourcePath;
}
if(GX_SurfaceViewFlag){
mSurfaceView = (SurfaceView) findViewById(R.id.playerSurfaceView1);
//mSurfaceView.setOnClickListener(this);
//mSurfaceView.setClickable(false);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.setKeepScreenOn(true);
mSurfaceHolder.addCallback(this);
}
while(masterPlayer == null){
;
}
}
在调用surfaceCreated()之后应该停止循环。然而,这从未发生过。 当我删除while循环时,它工作正常,并在设置surfaceView后调用surfaceCreated()。
我真的不擅长Android。请指点我解决它的方法。创建曲面后我需要信息以继续进行其他操作。