package com.spl.lc;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.view.Window;
import android.view.WindowManager;
enum WhichView {
MAIN_MENU, ZZCX_VIEW, CCCX_VIEW, CZCCCX_VIEW, LIST_VIEW, PASSSTATION_VIEW, CCTJ_VIEW, CZTJ_VIEW, GXTJ_VIEW, FJGN_VIEW, WELCOME_VIEW, ABOUT_VIEW, HELP_VIEW
}
public class MainActivity extends Activity {
WhichView curr;
WelcomeView wv;
static int flag;
String[][] msgg = new String[][] { { "" } };
String s1[];
String s2[];
Handler hd = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
goToWelcomeView();
break;
case 1:
goToMainMenu();
break;
case 2:
//setContentView(R.layout.about);
curr = WhichView.ABOUT_VIEW;
break;
case 4:
//setContentView(R.layout.help);
curr = WhichView.HELP_VIEW;
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//隐藏标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置全屏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//設置橫屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//iniTLisit();// 初始化提示框中數據的數組
this.hd.sendEmptyMessage(0);// 發送消息到初始歡迎界面 進入主界面
}
public void goToWelcomeView(){
setContentView(R.layout.activity_main);
if (wv == null) {
wv = new WelcomeView(this);
}
setContentView(wv);
curr = WhichView.WELCOME_VIEW;
}
// 返回到主菜單界面方法
public void goToMainMenu(){
setContentView(R.layout.mainmenu);
curr = WhichView.MAIN_MENU;
}
}
package com.spl.lc;
import android.content.Context;
public class WelcomeView {
Context text;
public WelcomeView(Context context){
this.text = context;
}
}
看到那個方法沒有 goToWelcomeView();
------解决方案--------------------
public void goToWelcomeView(){
setContentView(R.layout.activity_main);
if (wv == null) {
wv = new WelcomeView(this);
}
setContentView(wv);
curr = WhichView.WELCOME_VIEW;
}
怎么有两个?