title: Android- Firebase onChildChanged
body: <p>I would like my child data to update in real-time when I change the data. I am new in Java programming. The error was when i tried to set the my list arraylist with new child data, there is a error for wrong 2nd argument. The Following is my code...Appreciate any helps, Thank in advance.</p>
  
  <pre><code>public class OverallResultFragment extends Fragment {
      private static final String TAG = "OverallResultFragment";
  
      private ArrayList&lt;Booth&gt; list =  new ArrayList&lt;&gt;();;
      private ArrayList&lt;Booth&gt; mkeys = new ArrayList&lt;&gt;();
      ProductListAdapter adapter = null;
      private Firebase mRef;
      ListView gridView;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          Firebase.setAndroidContext(this.getContext());
          View view = inflater.inflate(R.layout.activity_votingresult, container, false);
          mRef = new Firebase("https://myfb.firebaseio.com/myfb");
          gridView = (ListView) view.findViewById(R.id.gridView);
          adapter = new ProductListAdapter(this.getContext(), R.layout.list_product_item, list);
          gridView.setAdapter(adapter);
  
  
          com.firebase.client.Query Queryref = mRef.orderByValue();
          Queryref.addChildEventListener(new com.firebase.client.ChildEventListener() {
              @Override
              public void onChildAdded(com.firebase.client.DataSnapshot dataSnapshot, String s) {
                  String value = dataSnapshot.getValue(String.class);
                  String boothname = dataSnapshot.getKey();
                  list.add(new Booth(boothname, value));
  
                  mkeys.add(new Booth(boothname));
                  adapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildChanged(com.firebase.client.DataSnapshot dataSnapshot, String s) {
                  String value = dataSnapshot.getValue(String.class);
                  String boothname = dataSnapshot.getKey();
  
                  int index = mkeys.indexOf(boothname);
                  list.set(index, value);//error on "value" -&gt; wrong 2nd argument.
                  adapter.notifyDataSetChanged();
              }
  }
  </code></pre>
  
  <p>And this is my Booth class:</p>
  
  <pre><code> public class Booth {
         String rating;
          String Boothname;
          int index;
  
  
          public Booth(String boothname, String Rating){
            this.Boothname = boothname;
              this.rating= Rating;
          }
  
          public String getBoothName(){
              return Boothname;
          }
          public void setProductId(String boothname){
              this.Boothname = boothname;
          }
  
          public String getRating(){
              return rating;
          }
          public void setRating(String rating){
              this.rating = rating;
          } 
      }
  </code></pre>