-1

大家好我第一次使用飞溅活动或他从我的应用程序注销。但是这在三星Galaxy S2上经常出现。这是我的活动onCreate()方法代码不跳转到主要活动

private static EditText serverIP = null; 
String mMDCServerIP = ""; 
String skipSplashScreenStatus = null; 
String mSplashScreenRunningStatus = null; 
String mDeniedStatusFromServer = null; 
public void onCreate(Bundle savedInstance) 
{ 
    super.onCreate(savedInstance); 
    /** Get the MDC IP **/ 
    Log.d("splash","1111111111111111"); 
    skipSplashScreenStatus = Config.getSetting(getApplicationContext(),"SPLASHSTATUS"); 
    mSplashScreenRunningStatus = Config.getSetting(getApplicationContext(),"SPLASHACTIVITYRUNNINGSTATUS"); 
    mDeniedStatusFromServer = Config.getSetting(getApplicationContext(),"DENYSTATUS"); 
    if(skipSplashScreenStatus == null || skipSplashScreenStatus.length() == 0) 
    { 
     Config.setSetting(getApplicationContext(),"DENYSTATUS","false"); 
    } 
    /** If SPLASHSTATUS does not exist then store the SPLASHSTATUS as false**/ 
    if(skipSplashScreenStatus == null || skipSplashScreenStatus.length() == 0) 
    { 
     Config.setSetting(getApplicationContext(),"SPLASHSTATUS","false"); 
    } 
    if(mSplashScreenRunningStatus == null || mSplashScreenRunningStatus.length() == 0) 
    { 
     Config.setSetting(getApplicationContext(),"SPLASHACTIVITYRUNNINGSTATUS","yes"); 
    } 
    Log.d("splash","222222222222222222"); 
    Log.d("splash","skipSplashScreenStatus : "+skipSplashScreenStatus); 
    skipSplashScreenStatus = Config.getSetting(getApplicationContext(),"SPLASHSTATUS"); 
    if(skipSplashScreenStatus!= null && skipSplashScreenStatus.equalsIgnoreCase("yes")) 
    { 
     Log.d("splash","inside if condition"); 
     skipSplashScreen();   
    } 
else{ 
    Log.d("splash","inside else condition"); 
    setContentView(R.layout.splash_screen); 
    Log.d("SPLASH","33333333333333"); 
    serverIP = (EditText) findViewById(R.id.splash_server_ip); 
    /** Get the MDC IP **/ 
    mMDCServerIP = Config.getSetting(getApplicationContext(),"IPADDR"); 
    /** If MDC IP does not exist then store the IP as 0.0.0.0**/ 
    if(mMDCServerIP == null || mMDCServerIP.length() == 0) 
    { 
     Config.setSetting(getApplicationContext(),"IPADDR","0.0.0.0"); 
    } 
serverIP.setOnEditorActionListener(new EditText.OnEditorActionListener() 
    { 
     @Override 
     public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 
     if (actionId == EditorInfo.IME_ACTION_SEARCH || 
       actionId == EditorInfo.IME_ACTION_DONE || 
       event.getAction() == KeyEvent.ACTION_DOWN && 
       event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { 
Config.setSetting(getApplicationContext(),"SPLASHSTATUS","yes"); 
Config.setSetting(getApplicationContext(),"SPLASHACTIVITYRUNNINGSTATUS","no"); 
skipSplashScreen(); 
}}}} 

这是skipSplashScreen()的代码;

private void skipSplashScreen() 
{ 
    try{ 
     Log.d("splash","inside skipSplashScreen 111"); 
     CommandHandler.mStopSendingKeepAlive = false; 
     Log.d("splash","inside skipSplashScreen 222"); 
     startActivity(new Intent(getApplicationContext() ,SecondTest.class)); 
    } 
    catch(Exception e) 
    { 
     Log.d("splash","Exception in skipSplashScreen 333"); 
     Log.d("splash",e.getMessage()); 
    } 
} 

一旦我挖掘更多的代码,它似乎控制skipSplashScreen()方法,但没有开始第二个活动。我可以知道可能是什么原因。

+0

请粘贴您的logcat的回答你的问题一起。 –

+0

我没有logcat响应,因为问题只发生在我的客户端电话上,他不愿意给日志。抱歉 – CodingRat

回答

1

试试这个,开始活动时,使用的Activity.this代替getApplicationContext()

private void skipSplashScreen() 
{ 
    try{ 
     Log.d("splash","inside skipSplashScreen 111"); 
     CommandHandler.mStopSendingKeepAlive = false; 
     Log.d("splash","inside skipSplashScreen 222"); 
     startActivity(new Intent(SplashScreen.this ,SecondTest.class)); 
    } 
    catch(Exception e) 
    { 
     Log.d("splash","Exception in skipSplashScreen 333"); 
     Log.d("splash",e.getMessage()); 
    } 
}