Duplicate objects from Firebase loaded into ListView
<p>When I add new message to a listview, that adds message that I have and the new message, so it puts the same information twice.</p>

<p>I want to load last messages in a listview with Firebase, I have the follow function into create():</p>

<pre><code>firebase = new Firebase(FIREBASE_URL).child(FIREBASE_CHILD + "/" + sharedPreferences.getString("chatKey", null).toString() + "/room/");

firebase.child("messages").addValueEventListener(new ValueEventListener() {

    @Override
    public void onDataChange(DataSnapshot Snapshot) {

        if (Snapshot.getValue() != null) {
            Iterable&lt;DataSnapshot&gt; iterator = Snapshot.getChildren();
            itemMessage itemData;

            for(DataSnapshot value : iterator){
                itemData = value.getValue( itemMessage.class );
                mCDataAdatapter.add( itemData.getMessage().toString() );
            }

           mConversation.setAdapter( mCDataAdatapter );
        }
    }
</code></pre>

<p>And for add new message:</p>

<pre><code>sendMessage.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {

        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ChatActivity.this);

        SharedPreferences.Editor editor = sharedPreferences.edit();

       // editor.clear().commit();

        if( sharedPreferences.getString("chatKey", null) != null &amp;&amp; sharedPreferences.getString("chatKey", null).toString() != "" ){

            messageLevel = new Firebase(FIREBASE_URL+sharedPreferences
                    .getString("chatKey", null)
                    .toString()+"/room/")
                    .child("messages");

            Map&lt;String, Object&gt; messageData = new HashMap&lt;String, Object&gt;();
            messageData.put( "message", message.getText().toString() );
            messageData.put( "userTo", 1 );
            messageData.put( "userFrom",2 );
            messageLevel
                    .push()
                    .setValue(messageData);

            mCDataAdatapter.add( message.getText().toString() );

            mConversation.setAdapter( mCDataAdatapter );

            message.setText("");

        }


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