2
I have a class B and in that class I need to call a method, getSomething(type, option)
, which is defined in a class A which is a class which extends AsyncTask
and which 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 the B class, within a method put this call to the getSomething method():
String sentence = new C().new A().getSomething(type,option);
also tried to:
new C().new A().execute();
I can’t call the method because it makes 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 made(...).
Can anyone help, to know how I can call the procedure from another class?
Thank you. I’m clear.
– porthfind