ListView is not populating on selecting the spinner item
<p>I have made two spinners - one for selecting city and the other for selecting the area within the city.I am fetching the data for city, area and the <code>ListView</code> to display after selecting from the Firebase Database.</p>

<p>I am populating the <code>ListView</code> with the help of a custom <code>ArrayAdapter</code> which will store the data in a <code>ArrayList</code> which will store data in the form of objects of class "vendorsInformation".</p>

<p>My java class which is manipulating data from Firebase database is :</p>

<pre><code>public class Location_Selection extends Fragment {
    ArrayList&lt;String&gt; listVendorEmail=new ArrayList&lt;&gt;();
    ArrayList&lt;String&gt; listVendorName=new ArrayList&lt;&gt;();
    ArrayList&lt;String&gt; listVendorPhoneNo=new ArrayList&lt;&gt;();

    ArrayList&lt;vendorsInfomation&gt; list_All_info_vendor=new ArrayList&lt;&gt;();

    String categorySelected;

    String citySelected;
    String areaSelected;

    public  Location_Selection(String categorySelected)
    {
        this.categorySelected= categorySelected;

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.city_selection_page,container,false);

        final Spinner areaSelector=(Spinner)view.findViewById(R.id.select_area);
        final Spinner selectCity=(Spinner)view.findViewById(R.id.selectCity);


        ListView listView = (ListView) view.findViewById(R.id.displayAllAstrologers);
        final displayingListAfterAreas listOfVendorsAdapter=new displayingListAfterAreas(getContext(),0,list_All_info_vendor);
        listView.setAdapter(listOfVendorsAdapter);


        selectCity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView&lt;?&gt; parent, final View view, int position, long id) {

                citySelected = selectCity.getSelectedItem().toString();


                final ArrayList&lt;String&gt; listAreas = new ArrayList&lt;String&gt;();


                String selectedCity = parent.getItemAtPosition(position).toString();
                FirebaseDatabase database = FirebaseDatabase.getInstance();
                DatabaseReference reference = database.getReference(selectedCity);

                reference.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {

                        if (dataSnapshot.hasChildren()) {
                            for (DataSnapshot child : dataSnapshot.getChildren()) {
                                String areaId = child.getKey().toString();
                                String areaName = child.getValue().toString();
                                listAreas.add(areaName);
                            }
                        }

                        ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter(view.getContext(),
                                android.R.layout.simple_spinner_item, listAreas);

                        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                        areaSelector.setAdapter(adapter);
                    }


                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });

            }

            @Override
            public void onNothingSelected(AdapterView&lt;?&gt; parent) {

            }
        });

        areaSelector.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {


                areaSelected=areaSelector.getSelectedItem().toString();

                listVendorEmail.clear();
                listVendorPhoneNo.clear();
                listVendorName.clear();

                FirebaseDatabase database1 = FirebaseDatabase.getInstance();
                DatabaseReference referenceForEmail = database1.getReference(categorySelected + "-" + citySelected + "-" + areaSelected + "/email");

                referenceForEmail.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {

                        if (dataSnapshot.hasChildren()) {
                            for (DataSnapshot child : dataSnapshot.getChildren()) {

                                String getEmailNo = child.getKey().toString();
                                String getEmailId = child.getValue().toString();
                                listVendorEmail.add(getEmailId);
                            }
                        }


                        }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }

                });

                DatabaseReference referenceForName=database1.getReference(categorySelected + "-" + citySelected + "-" + areaSelected + "/name");

                referenceForName.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        if (dataSnapshot.hasChildren()) {
                            for (DataSnapshot child : dataSnapshot.getChildren()) {
                                String getNameId = child.getKey().toString();
                                String getName = child.getValue().toString();
                                listVendorName.add(getName);
                            }
                        }
                    }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });


                DatabaseReference referenceForPhoneNo=database1.getReference(categorySelected+"-"+citySelected+"-"+areaSelected+"/phoneNo");

                referenceForPhoneNo.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        if(dataSnapshot.hasChildren())
                        {
                            for(DataSnapshot child: dataSnapshot.getChildren())
                            {
                                String getPhoneNoId=child.getKey().toString();
                                String getPhoneNo=child.getValue().toString();
                                listVendorPhoneNo.add(getPhoneNo);
                            }
                        }
                    }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });
                for(int i=0;i&lt;listVendorPhoneNo.size();i++)
                {
                    vendorsInfomation newObjectToStore=new vendorsInfomation(listVendorName.get(i),listVendorEmail.get(i),listVendorPhoneNo.get(i));
                    list_All_info_vendor.add(newObjectToStore);
                }
                listOfVendorsAdapter.notifyDataSetChanged();
            }

            @Override
            public void onNothingSelected(AdapterView&lt;?&gt; parent) {

            }
        });
        return  view;
    }
       }
</code></pre>

<p>My custom Adapter class is as follows:</p>

<pre><code>public class displayingListAfterAreas extends ArrayAdapter&lt;vendorsInfomation&gt; {


    Context context;
    ArrayList&lt;vendorsInfomation&gt; listDisplayingVendors;

    public displayingListAfterAreas(Context context, int resource, ArrayList&lt;vendorsInfomation&gt; objects) {

        super(context, resource, objects);
        this.context=context;
        listDisplayingVendors=objects;

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v;
        if (convertView == null) {

            v = inflater.inflate(R.layout.format_of_list_of_categories, null);
        } else {
            v = convertView;
        }

        ImageView image_of_customer=(ImageView)v.findViewById(R.id.image_of_customer);
        TextView name_of_customer=(TextView)v.findViewById(R.id.name_of_customer);
        TextView email_of_customer=(TextView)v.findViewById(R.id.email_id_of_customer);
        TextView phone_of_customer=(TextView)v.findViewById(R.id.phone_no_of_customer);

        image_of_customer.setImageResource(R.drawable.customer_photo);
        name_of_customer.setText(listDisplayingVendors.get(position).getVendorName());
        email_of_customer.setText(listDisplayingVendors.get(position).getVendorEmailId());
        phone_of_customer.setText(listDisplayingVendors.get(position).getVendorPhoneNo());

        return v;


    }
}
</code></pre>

<p>My vendorsInformation.java class of which form the objects are stored in ArrayList are:</p>

<pre><code>public class vendorsInfomation {

    String vendorName;
    String vendorEmailId;
    String vendorPhoneNo;

    public vendorsInfomation(String vendorName,String vendorEmailId,String vendorPhoneNo)
    {
        this.vendorName=vendorName;
        this.vendorEmailId=vendorEmailId;
        this.vendorPhoneNo=vendorPhoneNo;

    }

    public String getVendorName() {
        return vendorName;
    }

    public String getVendorEmailId() {
        return vendorEmailId;
    }

    public String getVendorPhoneNo() {
        return vendorPhoneNo;
    }

    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    public void setVendorEmailId(String vendorEmailId) {
        this.vendorEmailId = vendorEmailId;
    }

    public void setVendorPhoneNo(String vendorPhoneNo) {
        this.vendorPhoneNo = vendorPhoneNo;
    }

}
</code></pre>

<p>I am not getting the <code>ListView</code> populated in the view and while debugging the flow is not going inside this for-loop.</p>

<pre><code>for(int i=0;i&lt;listVendorPhoneNo.size();i++)
                {
                    vendorsInfomation newObjectToStore=new vendorsInfomation(listVendorName.get(i),listVendorEmail.get(i),listVendorPhoneNo.get(i));
                    list_All_info_vendor.add(newObjectToStore);


                }
</code></pre>

<p>So there are not items in the <code>list_All_info_vendor</code> <code>ArrayList</code>.</p>