Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyCallingClass extends ActivityBase {
- private String _result = null;
- protected void onCreate(Bundle savedInstanceState) {
- callingMethod();
- }
- protected void callingMethod() {
- MyASyncClass whatever = new MyASyncClass(new MyASyncClass.AsyncResponse() {
- @Override
- **void processFinish(String output)**{
- _result = output;
- }
- }).execute();
- }
- // More work done here
- }
- public class MyASyncClass extends AsyncTask<String, String, String> {
- public interface AsyncResponse {
- void processFinish(String output);
- }
- public AsyncResponse delegate = null;
- public DeviceConnect(AsyncResponse delegate){
- this.delegate = delegate;
- }
- @Override
- protected String doInBackground(String... params) {
- // Does the work
- }
- @Override
- public void onPostExecute(String result) {
- delegate.processFinish(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement