-3

There is an asynckTask and 2 methods,which are being called by 2 activities. i Want to keep the AsyncTask class and the methods inside myApplication class

http://developer.android.com/reference/android/app/Application.html

( which was needed anyway,had some states of app to be maintained).

One other way is to have those methods in each activity and the asyncTask as independent class.

what is the best way?

Vikas Pandey
  • 1,115
  • 1
  • 15
  • 25

1 Answers1

1

How about having a base activity class for that?
Something like:

public class BaseActivity extends Activity {
    protected void myMethod() {
        // do what ever
    }
}

Then just extend this BaseActivity to have that method in your activities.

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299