9
I have searched StackOverflow and the web for an answer to this question, but I could not find an answer. When I run my application on Gingerbread, it runs fine. But when I run it on 4.2.2, I get this error: java.lang.IllegalStateException Cannot perform this operation because the connection pool has been closed
I have a SherlockFragmentActivity which contains two fragments.
Fragment 1:
public final class TodoFragment extends SherlockListFragment {
NotesDbAdapter db;
private static final int DELETE_ID = Menu.FIRST + 1;
public static TodoFragment newInstance(String s) {
TodoFragment fragment = new TodoFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new NotesDbAdapter(getActivity());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null) {
return null;
}
return ll;
}
Fragment 2:
public final class NotesFragment extends SherlockListFragment {
NotesDbAdapter db;
private static final int ACTIVITY_EDIT = 1;
private static final int DELETE_ID = Menu.FIRST + 1;
public static NotesFragment newInstance(String content) {
NotesFragment fragment = new NotesFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new NotesDbAdapter(getActivity());
db.open();
if (db.fetchAllNotes().getCount() == 0) {
doWelcomeMessage();
}
db.close();
}
private void doWelcomeMessage() {
// Show welcome dialog
startActivity(new Intent(getActivity(), NotesWelcome.class));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null) {
return null;
}
db = new NotesDbAdapter(getActivity()