2013-09-24 3 views
0

내 응용 프로그램에서 나는 인터넷에서 데이터를 얻을 필요가있다. 그래서 내가 스플래시 화면에서 다시 바닥에있는 방법을 처리하고 스플래시 화면이 사라진 후에해야합니다.안드로이드 데이터 수신

public class Splash_Screen extends Activity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_splash__screen); 

     ProgressBar p_bar=(ProgressBar)findViewById(R.id.progressBar1); 

     Thread thread=new Thread(new Runnable() { 

      @Override 
      public void run() 
      { 
       data_receiver receiver=data_receiver.getInstance(); 
       receiver.access_parser(); 

      } 
     }); 
     thread.start(); 

     new Handler().postDelayed(new Runnable() { 

      @Override 
      public void run() { 
       Intent main_window=new Intent(com.burusoth1990.advertise.Splash_Screen.this,com.burusoth1990.advertise.MainActivity.class); 
       startActivity(main_window); 

      } 
     }, 5000); 

    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.activity_splash__screen, menu); 
     return true; 
    } 

} 

시작 화면의 필요성이 시작 화면 활동을 종료하고 새로운 활동을 개방 한 후 다시 지상에서 작업을해야 오초하지만 receiver.access_parser() 메소드 작동합니다. 이것은 내 코드이지만 오류가 발생합니다. 안드로이드

+0

사용 안드로이드 서비스를 백그라운드 프로세스에 가장 좋은 방법입니다. – Burusothman

답변

0

배경 작업, 직접 하나의 활동에 연결되지 않은, 특히는 일반적으로 서비스 또는 IntentService를 사용하여 구현된다. 이러한 설명서 페이지를 참조하십시오

+0

필요에 맞는 IntentService를 제안합니다. 그것은 한 번 시작되고 완료 될 때까지 계속 실행되기 때문에 다소 간단합니다. 프레임 워크는 바인딩 등을 고려하는 모든 것을 처리합니다. – cYrixmorten

+0

작업 예제 링크가 있습니까 ..... – Burusothman