こんにちは、初めてスプラッシュ アクティビティを使用しているか、アプリからログアウトしています。しかし、これは Samsung 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()メソッドですが、2番目のアクティビティを開始していないようです。何が原因かわかるかもしれません。