In terms of life cycle, when I call stopService(intent), does the service's onDestroy() get called right away? I am asking because I have problem getting the onDestroy() called to kill this thread the service generates.
Thanks in advance!
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);
}
});
As you can see, I called stopService() to kill any previous services(query threads) to start a new service(new query thread).