라이프 사이클 측면에서 stopService (intent)를 호출하면 서비스의 onDestroy()가 즉시 호출됩니까? 나는 서비스가 생성하는이 스레드를 죽이기 위해 호출 된 onDestroy()를 얻는 데 문제가 있기 때문에 묻습니다.stopService (intent)를 호출 할 때
미리 감사드립니다.
button.setOnClickListener(new OnClickListener(){
public void onClick(View v){
Log.d(Tag, "in button's onClick");
Log.d(Tag, field.getText().toString());
String busNo = field.getText().toString();
field.setText("");
field.setAdapter(clearAdapter);
String url = makeURL(busNo);
Log.d(Tag, "after makeURL(), url is now "+url);
Intent intent = new Intent(JSoupTest9Activity.this, ServiceTest.class);
Log.d(Tag, "intent created...");
intent.putExtra("URL", url);
Log.d(Tag, "intent's extra put");
Log.d(Tag, "stopping intent service");
stopService(intent);
Log.d(Tag, "starting intent service");
startService(intent);
Log.d(Tag, "service started");
//pendingIntent = PendingIntent.getService(JSoupTest8Activity.this, 0, intent, 0);
//alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 30*1000, pendingIntent);
}
});
당신이 볼 수 있듯이
, 나는 stopService 전화() 새로운 서비스 (새 쿼리 스레드를) 시작 이전 서비스 (쿼리 스레드를) 죽일.
다른 스레드를 생성하는 서비스라고 생각? – Shachillies
코드를 업로드하십시오. – Lucifer
예. onDestroy()는 stopService()가 실행될 때 호출됩니다. – AndroidGuy