MAIN KLASE:
public final class MainActivity extends Activity {
private void sendSmsWithAddress(String troubleType, LatLng coordinates, String address) {
double lat = coordinates.latitude;
double lng = coordinates.longitude;
sendSmsToContacts(troubleType + "!\n" + address + "\nhttp://ubersafe.com/" + lat + "/" + lng);
}
}
NAUJA KLASE:
public final class TroubleRepeater {
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Runnable CoordinatesFinder = new Runnable() {
public void run()
{
private void sendSmsWithCoordinates(String troubleType, LatLng coordinates) {
double lat = coordinates.latitude;
double lng = coordinates.longitude;
sendSmsToContacts(troubleType + "! Coordinates:\n(" + lat + ", " + lng + ")\nhttp://ubersafe.com/" + lat + "/" + lng);
}
}
};
ScheduledFuture result = executor.scheduleAtFixedRate(CoordinatesFinder, 2, 30, TimeUnit.SECONDS);
}
Man reikia kad main klaseje esanti veiksma kartotu x kartu. Bandau istrint is main sita veiksma ir perkelt ji i nauja sukurta klase ( paziurekit ar gerai atliktas kartojimo procesas) ir man reikia ja iskviesti main klaseje, kaip tai galeciau padaryti?
Paskutinį kartą redagavo: 27 Balandžio 2016 - 01:44