title: How can i filter my firebase database and add them to my android spinner?
body: <p>So i have this family database and i want a spinner that list of curvillage and filter them not to repeat cuz many people will have same curvillage.
  <p>Tell me how to show spinner for all curvillage. 
  after this i want to make a new page where display all people from same curvillag i selected.</p>
  
  <pre><code>Spinner spinner;
  DatabaseReference databaseReference;
  ValueEventListener listener;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
          listener=databaseReference.child("family").addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  final List&lt;String&gt; family=new ArrayList&lt;String&gt;();
                  for(DataSnapshot familySnapshot:dataSnapshot.getChildren()){
                      String familyname=familySnapshot.child("curvillage").getValue(String.class);
                  }
  
                  Spinner spinner = (Spinner) findViewById(R.id.dataspinner);
                  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_spinner_item, family);
                  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                  spinner.setAdapter(adapter);
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              }
          });
  }
  </code></pre>
  
  <p>}</p>
  
  <p><a href="https://i.stack.imgur.com/j6MCL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j6MCL.png" alt="enter image description here"></a></p>