2012-11-13 3 views
0

원격 서버를 시작할 때 호출하는 활동이 있습니다. 사실 앱이 백그라운드에 있고 서버가 새 콘텐츠를 만들 때 내 앱을 복원 할 때 앱이 종료되고 다시 시작되지 않으면이 새로운 콘텐츠가 표시되지 않습니다.Android : 홈 버튼을 누른 후 onResume()이 호출되지 않음

서버에서이 정보를 모두 가져 오는 코드를 'onResume()'메서드에 두었습니다.이 메서드는 앱이 종료되고 다시 시작될 때 작동하지만, 홈 버튼을 눌러 백그라운드로 보내지는 경우에는 작동하지 않습니다.

왜 'onResume()'메서드가 호출을받지 못합니까? 전화를 걸려면 어떻게해야합니까?

미리 감사드립니다.

내가 가지고있는 코드 :

@Override 
    protected void onResume() { 
     super.onResume(); 
     Server server = new Server(this); 
     server.GetHighlights(10, 0, null); 
     server.GetNews(10, 0, null); 
     server.GetBrands(12, 0, null); 
     Log.i("XS2", "Resume"); 
    } 

    public void onCreate(Bundle icicle) { 
     Log.i("XS2", "Create"); 
     super.onCreate(icicle); 
     this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     setContentView(R.layout.splash_media_player); 
     mPreview = (VideoView) findViewById(R.id.surface); 
     if (mPreview != null) { 
      mHolder = mPreview.getHolder(); 
      mHolder.addCallback(this); 
     } 

//  Server server = new Server(this); 
//  server.GetHighlights(10, 0, null); 
//  server.GetNews(10, 0, null); 
//  server.GetBrands(12, 0, null); 

     // google analytics set up 
     AnalyticsHelper.initializeTrackerInstance(getApplicationContext()); 
    } 
+0

앱이 백그라운드로 돌아 왔고 다시 앞으로 오게되면 onResume이 항상 호출됩니다. 문제는 다른 곳에 있어야합니다 ... 코드를 표시 할 수 있습니다 .... –

+0

onResume이 호출되고 있습니다. \ –

+0

onResume()과 onCreate()를 호출 할 때 'Log'를 넣고 내 앱을 복원 할 때 아무 것도 볼 수 없습니다. – noloman

답변

3

오른쪽, 문제는 광산이었다 조각으로 리디렉션 내 활동 (그것이 시작 acitivity이고이 완료되면, 그것은 조각을 시작할 것). 그리고이 부분에서 'onResume()'을 넣어야합니다.

도움을 주신 모든 분들께 감사드립니다.

관련 문제