I’m developing an Android application but have hit a bit of a brick wall, I keep getting the error:
Illegal modifier for the class FavsPopupFragment; only public, abstract & final are permitted
This happened after following this answer to another SO question. Here is the code that I have:
package com.package.name;
/* Imports were here */
public static class FavsPopupFragment extends SherlockDialogFragment {
static FavsPopupFragment newInstance() {
FavsPopupFragment frag = new FavsPopupFragment();
return frag;
}
}
The error appears on the class name. I don’t understand why this won’t work, please help. Thank you.
You can’t create a top level static class; that’s what the compiler is trying to tell you. Also have a look at the answer here as to why this is the case. The gist is: