This is, what I think is a basic java question here:
This is for an Android project. I have this setup:
public class MyFragmentActivity extends FragmentActivity implements
ActionBar.TabListener {
// lots of code edited out
public static class RateFragment extends Fragment {
// lots of code edited out
class InsertTask extends AsyncTask<String, String, Void> {
protected void onPostExecute(Void v) { {
// I need to access ReviewTask here
new ReviewTask().execute();
}
}
}
public static class ReviewFragment extendsListFragment {
class ReviewTask extends AsyncTask<String, String, Void> {
// code
}
}
}
I am really asking a basic Java question. I know its not the best method in Android.
If you must know what I am doing: (If this is confusing, this information is low priority, just for some context) I call InsertTask when a button is pressed in RateFragment and inserts data into a MySQL database. This is what I want to do in the above code: In InsertTask, at the end, call ReviewTask in the other inner class. This will update the listview (which is in the other tab).
Can ReviewTask be reached from InsertTask?
I don’t think you can do it. I just tried it out. Here’s what you can do though… have a method inside the fragment which the InsertTask’s postExecute() method calls on. In this fragment method, you can create a new ReviewTask and fire the task. This way your inner classes just talks to your parent class which acts as a delegate between calls.
EDIT: