I'm trying to implement Realm database in my project, I have a class with methods to add items in the database, I use that class to store those methods and call them in my fragment, but when I do that I get an error:
java.lang.NullPointerException: Attempt to invoke interface method 'void io.realm.RealmChangeListener.onChange()' on a null object reference
What am I doing wrong here?
public class Repositorio extends GlobalActivity {
    private RealmChangeListener realmListener;
    public Realm realm;
    private Context context;
    public Repositorio() {
    }
    public Repositorio(Context context) {
        this.context = context;
        this.realm = Realm.getDefaultInstance();
        this.realmListener = new RealmChangeListener() {
            @Override
            public void onChange() {
                Log.i("realmtest", "some values in the database have been changed");
            }
        };
        this.realm.addChangeListener(realmListener);
    }
    public void addCliente(String nome, String local, String estado, String telefone, String email, String tipo) {
        realm.beginTransaction();
        Pessoa mPessoa = realm.createObject(Pessoa.class);
        mPessoa.setId(UUID.randomUUID().toString());
        mPessoa.setNome(nome);
        mPessoa.setCidade(local);
        mPessoa.setEstado(estado);
        mPessoa.setTelefone(telefone);
        mPessoa.setEmail(email);
        mPessoa.setTipo(tipo);
        realm.commitTransaction();
        Toast.makeText(context, "Cliente adicionado com sucesso", Toast.LENGTH_LONG).show();
    }
    @Override
    public void onPause() {
        super.onPause();
        realm.removeChangeListener(realmListener);
    }
    @Override
    public void onResume() {
        super.onResume();
        realm.addChangeListener(realmListener);
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (realm != null) {
            realm.close();
            realm = null;
        }
    }
}
Fragment:
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        final View v = inflater.inflate(R.layout.cadastra_produtos, container, false);
        mRepositorio = new Repositorio(getActivity());
        novocliente = (TextView) v.findViewById(R.id.novocliente);
        novocliente.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRepositorio.addCliente("ZÉ", "LALAAL", "SC", "3333-3333", "teste@teste.com", "Pessoa Física");
            }
        });
        return v;
    }
Global:
public class GlobalActivity extends AppCompatActivity {
    public Ferramentas mFerramentas;
    public Realm realm;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mFerramentas = new Ferramentas();
        realm = Realm.getDefaultInstance();
    }
}
 
    