Hallo,
ich erstelle einen Thread um Daten aus dem Web zu laden:
Ich übergebe eine Referenz des Ursprung und rufe dann im Thread eine Methode auf um die Daten in der Hauptanwendung zu verarbeiten.
Ist das soweit ok?
Danke!
ich erstelle einen Thread um Daten aus dem Web zu laden:
Java:
pullData = new PullData(getPropertyCityId(), getPropertyUserId(), this);
pullData.run();
Java:
public class PullData extends Thread {
public String cityId, userId;
WeatherForecast weatherForecast;
PullData(String cityID, String userId, WeatherForecast weatherForecast) {
this.cityId = cityID;
this.userId = userId;
this.weatherForecast = weatherForecast;
}
public void run() {
...
weatherForecast.pullData(doc);
Java:
public synchronized void pullData(Document doc) {
NodeList locations = doc.getElementsByTagName("location");
Node location = locations.item(0);
Ich übergebe eine Referenz des Ursprung und rufe dann im Thread eine Methode auf um die Daten in der Hauptanwendung zu verarbeiten.
Ist das soweit ok?
Danke!