Java – Unable to pass parameter to super(); In the constructor of the class that extends the RealmBaseAdapter (Realm).

Unable to pass parameter to super(); In the constructor of the class that extends the RealmBaseAdapter (Realm)…. here is a solution to the problem.

Unable to pass parameter to super(); In the constructor of the class that extends the RealmBaseAdapter (Realm).

I

have a problem, I can’t pass the parameter “context, realmResults, automaticUpdate” to super(); In the constructor of the class that extends the RealmBaseAdapter. See my code and screenshots to get you at a glance.

* My code:

package com.twitter.i_droidi.notah;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import io.realm.RealmBaseAdapter;
import io.realm.RealmObject;
import io.realm.RealmResults;

public class RealmModelAdapter <T extends RealmObject> extends RealmBaseAdapter<T> {

public RealmModelAdapter(Context context, RealmResults<T> realmResults, boolean automaticUpdate)
    {
        super(context, realmResults, automaticUpdate);
    }

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return null;
    }
}

* Screenshot:

* Realm version: 1.0.1

Android Studio version: 2.1.2

Solution

In the latest version of Realm

, the constructor of the RealmBaseAdapter is changed to

RealmBaseAdapter(android.content.Context context, OrderedRealmCollection<T> data, boolean automaticUpdate).

Therefore, you need to replace RealmResults<T> with OrderedRealmCollection<T> in your code.

https://realm.io/docs/java/latest/api/io/realm/RealmBaseAdapter.html

Related Problems and Solutions