Created
April 3, 2015 22:52
-
-
Save diegoaguilar/6fc79761d886e59c6d4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface MyListener{ | |
public void heard(String response); | |
} | |
public void launchTask() | |
{ | |
new MyTask(listener).execute(); | |
} | |
MyListener listener = new MyListener(){ | |
public void heard(response){ | |
//Do whatever you wanted | |
} | |
} | |
public class MyTask extends AsyncTask<Void, Void, Void>{ | |
private MyListener listener; | |
public MyTask(MyListener listener){ | |
this.listener = listener; | |
} | |
... | |
protected void onPostExecute(){ | |
listener.heard("Word up"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment