0

I have an Android code like:

protected void onPostExecute(String result){            
parseJSON(result);
replaceResourceSegment();
dummyMethod();
}

My replaceresourceSegment(creates an intent) method takes some time to execute within which dummyMethod() gets called. Do I have a means to order the execution of methods or notify after a method gets completed in Android(like threads in Java)? Please suggest me, if I have to use a Handler or AsyncTask or Thread for accomplishing the same... Any help will be appreciated. Thanks in advance!

user1637909
  • 173
  • 1
  • 3
  • 14
  • you could use a handler and execute a method postdelayed: http://stackoverflow.com/questions/7038463/why-does-handlerpostdelay-make-ui-frozen – Bruno Bieri Sep 26 '12 at 08:31
  • Ya but I need some notification mechanism after the method replaceResourceSegment() completes. As the time taken to execute my method may vary. – user1637909 Sep 26 '12 at 09:09
  • I used startActivityForResult() and defined the dummyMethod() inside onActivityResult(). It worked :) – user1637909 Sep 26 '12 at 12:35
  • You can post that as answer and mark it as the correct answer. – Bruno Bieri Sep 26 '12 at 17:26

1 Answers1

0

I used startActivityForResult(intent, REQUEST_CODE) and defined the contents of dummymethod() in onActivityResult(int requestCode, int ResultCode, Intent data).

user1637909
  • 173
  • 1
  • 3
  • 14