I have a class B and in this class I need to call a method, getSomething(type, option)
, which is defined in a class A that is a class that extends AsyncTask
and that is within class C.
My class C is defined as follows:
public class C extends BaseActivity{
(...)
public class A extends AsyncTask<String, Void, String> {
(...)
public String doInBackground(String... params) {
(...)
}
public String getSomething(String type, String option){
(...)
}
protected void onPreExecute() {
(...)
}
protected void onPostExecute(String result){
(...)
}
(...)
}
What I'm trying to do is within class B, inside a method put this call to the getSomething () method:
String sentence = new C().new A().getSomething(type,option);
I've already tried it:
new C().new A().execute();
I can not call the method because it gives me an exception
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
whenever the call to the getSomething (.) method is executed.
Can anyone help, how can I call the procedure from another class?