3

is this possible to save AsyncTask class object on rotation and reuse it again.

  public class MyTask extends AsyncTask<Void, Void, Integer>
    {

    }

any good solution. Thanks

Monty
  • 3,205
  • 8
  • 36
  • 61

1 Answers1

2

is this possible to save AsyncTask class object on rotation and reuse it again.

Use onRetainNonConfigurationInstance() or a retained fragment.

thanks for reply but onRetainNonConfigurationInstance() deprecated after 3.0

That is because they recommend that you use a retained fragment instead. If you are not using fragments, use onRetainNonConfigurationInstance().

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491