Android : Cannot get data from database

Hello everyone,  sorry i was doing a simple exercise about getting Data from my database and paste it to a RecycleView to show it. I have finished the code and when I built it, there is no errors. I have three class :

1-MainActivity.class in which I have placed my recyclerView

2- NomAdapter.class for adapting my items

3-Nomprenom.class for keeping my incoming datas

i have also authorized Internet permission in Manifest

Let put the code

//In mainActivity class

  aRecycleView = (RecyclerView) findViewById(R.id.recyclerView_eleve);

        aRecycleView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
        aRecycleView.setHasFixedSize(true);

        customRequest = CustomRequest.getInstance(getApplicationContext(), ServerAddress.Nomprenom_URL);
        customRequest.setErrorListener(new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Toast.makeText(getApplicationContext(), "Problème de connexion", Toast.LENGTH_SHORT).show();
            }
        }).setErrorListener(this)
                .setMethod(Request.Method.GET)
                .commit();
    }
    @Override
    public void onResponse(String response) {
        parseStudent(response);
    }

then, the parseStudent function :

private void parseStudent(String response) {
        try {
            JSONArray jsonArray = new JSONArray(response);
            for (int i = 0; i < jsonArray.length(); i++){
                //find obj json
                JSONObject obj = jsonArray.getJSONObject(i);
                //find data by key
                //instanciate Invitation class
                NomPrenom nomPrenom = new NomPrenom();
                nomPrenom.setNomprenom(obj.getString("NomPrenom"));
                nomPrenom.setMatricule(obj.getString("Matricule"));

                Log.d("APP", "error = " + response);
                //add to recycler adapter
                nomPrenoms.add(nomPrenom);

            }
            nAdapter.setNomPrenomArrayList(nomPrenoms);
            aRecycleView.setAdapter(nAdapter);

        } catch (JSONException e) {
            Log.d("APP", "error = " + e.getMessage());
            //ignore
            Toast.makeText(getApplicationContext(), "Aucun élève disponible!", Toast.LENGTH_LONG).show();
        }

    }

And the last if it can help, the Adapter :

public class NomAdapter extends RecyclerView.Adapter<NomAdapter.MyViewHolder> {

    //liste des élèves disponibles
    private ArrayList<NomPrenom> mDatas;
    private ViewHolder holder;
    private int position;

    public NomAdapter(){
        mDatas = new ArrayList<>();
    }


    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.nom_eleve_model, parent, false);
      return new NomAdapter.MyViewHolder(view);
    }


    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        //recupère la position du message à afficher
        final NomPrenom nomPrenom = mDatas.get(position);
        holder.bindView(nomPrenom);
    }


    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    public NomAdapter(ArrayList<NomPrenom> nomPrenomArrayList){
        mDatas = new ArrayList<>();
        mDatas.addAll(nomPrenomArrayList);
    }
    public void add(NomPrenom nomPrenom){
        mDatas.add(nomPrenom);
        notifyDataSetChanged();
    }
    public void remove(NomPrenom nomPrenom){
        mDatas.remove(nomPrenom);
        notifyDataSetChanged();
    }

    public void remove(int pos){
        mDatas.remove(pos);
        notifyItemRemoved(pos);
    }

    public void setNomPrenomArrayList(ArrayList<NomPrenom> nomPrenomArrayList) {
        this.mDatas = nomPrenomArrayList;
    }

    class MyViewHolder extends RecyclerView.ViewHolder{

        TextView model_textview, matricule_textview_model;

        private MyViewHolder(View itemView) {
            super(itemView);
            model_textview = (TextView) itemView.findViewById(R.id.textView_model);
            matricule_textview_model = (TextView) itemView.findViewById(R.id.textView_matricule_model);
        }

        public void bindView(NomPrenom nomPrenom){
            model_textview.setText(nomPrenom.getNomprenom());
            matricule_textview_model.setText(nomPrenom.getMatricule());

        }

    }

}

Could you help me please !!!

Hi @stevrims,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the Project Development Help and Advice board. No action is needed on your part; you can continue the conversation as normal here.

Cheers!