java.lang.InstantiationException: class com.e has no zero argument constructor

You need to define a no-args constructor, just as the error says:

public Search() {
    // No args constructor
}

The context that you need for your adapter is the Activity itself, you don't need to get it via the constructor. Just use this, since you are already in the context of an activity:

mAdapter = new MyAdapter(getDataSet(), this);

And then you can drop the overloaded constructor that you defined for your custom activity.


In search, you created the constructor

public Search(Context context) {
    mContext = context;
}

Now, since you have a user defined constructor, your compiler does not provide you with any default constructors, so you need to define a parameter-less constructor yourself too.

public Search() {
    // Constructor body
}

Tags:

Android