title: How do we get number of child nodes of root node using Android code?
body: <p>I am explaining the scenario using the following image: <a href="https://i.stack.imgur.com/t93jG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t93jG.png" alt="enter image description here" /></a></p>
  <p>from that, I would like to get the name and number of nodes. From this image, I would like to get nodes' names (Company, GovDepartment, and students) and their count number. for example, there are 3 numbers of nodes are present which stored as Company, GovDepartment, and students, how could I get it? how could I make it complete? the following android code needs to complete:</p>
  <pre><code>import androidx.appcompat.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.EditText;
  import android.widget.Toast;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  
  public class MainActivity extends AppCompatActivity {
      EditText t1,t2,t3,t4;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      public void process(View v){
          
          dataholder obj = new dataholder(name,course,duration);
          FirebaseDatabase db = FirebaseDatabase.getInstance();
          DatabaseReference node = db.getReference();
      }
  }
  </code></pre>
  <p>here the method called by a OnClick button as:</p>
  <pre><code>&lt;Button
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:onClick=&quot;process&quot;
      android:text=&quot;Read and count the nodes&quot;
      android:textSize=&quot;25dp&quot;
      app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintHorizontal_bias=&quot;0.491&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      app:layout_constraintVertical_bias=&quot;0.66&quot;
      tools:ignore=&quot;MissingConstraints,OnClick&quot; /&gt;
  </code></pre>
  <p>you may use the another layout to show the fetched data from the firebase database.</p>