Jump to content

Java Help Fast

Recommended Posts

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);

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);

I need in main class action repeat x times. I am trying to delete from main class this action and add him to new class (check my repeater, it works good or not)
 and i need call it in main class, how i can do it?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock