I have the following code
public abstract class BaseAdapter extends ArrayAdapter {
public BaseAdapter(Con
Happened the same to me when extending a Base class. But this time I had it like this (following the given example in the question)
BaseAdapter.java
public abstract class BaseAdapter extends ArrayAdapter {
public BaseAdapter(Context context, int resource, Collection collection) {
// typical constructor logic
}
// some other custom defined methods
public static class ViewHolder {
// custom defined logic
}
}
ModelAdapter.java
import com.mypackage.ModelAdapter.ModelViewHolder; ***//NOTE THIS IMPORT!!!***
public class ModelAdapter extends BaseAdapter {
public ModelAdapter(Context context, int resource, Collection collection) {
super(context, resource, collection);
// typical constructor logic
}
public static class ModelViewHolder extends ViewHolder {
// custom defined logic
}
}
That way the warning was gone and didnt need to separate ModelViewHolder into another '.java' file. Notice that they are in two different files and the import in ModelAdapter.java.
I think Fei Liang's answer is partially incorrect because being ModelViewHolder static should make possible to initialize ModelViewHolder without initializing its parent class ModelAdapter