I got multiple times same data from firebase database, I need only once from firebase database












0















i am recently created an app which is still in development.
In need your help because, whenever i get data from firebase database i comes single data in multiple times. Look below my code, database where you get my question properly and you also get what i'm trying to say.



My code :



public class FragmentChat extends Fragment
{
EditText mMsgInput;
Button mSend;
LinearLayout mMsgContainerTv;
ScrollView mMsgContainer;
ProgressDialog mProgressDialog;

String name, email, image;

FirebaseAuth mAuth;
DatabaseReference mDataRef, mChatroomRef, mMessageRef;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreateView(inflater, container, savedInstanceState);

View chat = inflater.inflate(R.layout.fragment_chat, container, false);

mMsgInput = (EditText) chat.findViewById(R.id.fragment_chatETMsg);
mSend = (Button) chat.findViewById(R.id.fragment_chatBTSend);
mMsgContainerTv = (LinearLayout) chat.findViewById(R.id.fragment_chatLLMsgContainer);
mMsgContainer = (ScrollView) chat.findViewById(R.id.fragment_chatSVMsgContainer);

mAuth = FirebaseAuth.getInstance();
mDataRef = FirebaseDatabase.getInstance().getReference();
mChatroomRef = FirebaseDatabase.getInstance().getReference().child("Chatroom");

if(mAuth.getCurrentUser() == null){
Toast.makeText(getActivity(), "Please Login First", Toast.LENGTH_SHORT).show();
}else{
mProgressDialog = new ProgressDialog(getActivity());
mProgressDialog.setTitle("Loading data...");
mProgressDialog.setMessage("Please wait while we load your data into activity...");
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.show();

mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addValueEventListener(new ValueEventListener(){
@Override
public void onDataChange(DataSnapshot dataSnapshot)
{
name = dataSnapshot.child("name").getValue().toString();
email = dataSnapshot.child("email").getValue().toString();
image = dataSnapshot.child("image").getValue().toString();

mProgressDialog.dismiss();
}

@Override
public void onCancelled(DatabaseError p1)
{
mProgressDialog.dismiss();
}
});

sendmsg();
}
return chat;
}

@Override
public void onStart()
{
super.onStart();

if(mAuth.getCurrentUser() != null){
mChatroomRef.addChildEventListener(new ChildEventListener(){
@Override
public void onChildAdded(DataSnapshot data, String s)
{
if(data.exists()){
displayMsg(data);
}
}

@Override
public void onChildChanged(DataSnapshot data, String s)
{
if(data.exists()){
displayMsg(data);
}
}

@Override
public void onChildRemoved(DataSnapshot data)
{
}

@Override
public void onChildMoved(DataSnapshot data, String s)
{
}

@Override
public void onCancelled(DatabaseError ata)
{
}
});
}
}

private void sendmsg()
{
mSend.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v)
{
String msg = mMsgInput.getText().toString();

HashMap<String, Object> mHashmapS = new HashMap<String, Object>();
mChatroomRef.updateChildren(mHashmapS);
String mMessageKey = mChatroomRef.push().getKey();
mMessageRef = mChatroomRef.child(mMessageKey);
HashMap<String, Object> mHashmapMessage = new HashMap<String, Object>();
mHashmapMessage.put("name", name);
mHashmapMessage.put("msg", msg);
mMessageRef.updateChildren(mHashmapMessage);

mMsgInput.setText("");

Toast.makeText(getActivity(), "Message sent successfully...", Toast.LENGTH_SHORT).show();
}
});
}

private void displayMsg(DataSnapshot data)
{
Iterator it = data.getChildren().iterator();
while(it.hasNext()){
String msgMsg = (String) ((DataSnapshot) it.next()).getValue();
String msgName = (String) ((DataSnapshot) it.next()).getValue();

LayoutInflater mInflator = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View mView = mInflator.inflate(R.layout.item_msg, null);
TextView mMsgView = (TextView) mView.findViewById(R.id.item_msgTVMsg);
mMsgView.append(msgName + " :n" + msgMsg + "n ");
mMsgContainerTv.addView(mView, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

mMsgContainer.fullScroll(ScrollView.FOCUS_DOWN);
}
}
}


My database structure :
chatroom >> messagekey >> 1. msg, 2. name



In my application i got multiple times same msg and name



And also i want data in way it is in database structure into the my app.










share|improve this question





























    0















    i am recently created an app which is still in development.
    In need your help because, whenever i get data from firebase database i comes single data in multiple times. Look below my code, database where you get my question properly and you also get what i'm trying to say.



    My code :



    public class FragmentChat extends Fragment
    {
    EditText mMsgInput;
    Button mSend;
    LinearLayout mMsgContainerTv;
    ScrollView mMsgContainer;
    ProgressDialog mProgressDialog;

    String name, email, image;

    FirebaseAuth mAuth;
    DatabaseReference mDataRef, mChatroomRef, mMessageRef;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
    super.onCreateView(inflater, container, savedInstanceState);

    View chat = inflater.inflate(R.layout.fragment_chat, container, false);

    mMsgInput = (EditText) chat.findViewById(R.id.fragment_chatETMsg);
    mSend = (Button) chat.findViewById(R.id.fragment_chatBTSend);
    mMsgContainerTv = (LinearLayout) chat.findViewById(R.id.fragment_chatLLMsgContainer);
    mMsgContainer = (ScrollView) chat.findViewById(R.id.fragment_chatSVMsgContainer);

    mAuth = FirebaseAuth.getInstance();
    mDataRef = FirebaseDatabase.getInstance().getReference();
    mChatroomRef = FirebaseDatabase.getInstance().getReference().child("Chatroom");

    if(mAuth.getCurrentUser() == null){
    Toast.makeText(getActivity(), "Please Login First", Toast.LENGTH_SHORT).show();
    }else{
    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setTitle("Loading data...");
    mProgressDialog.setMessage("Please wait while we load your data into activity...");
    mProgressDialog.setCanceledOnTouchOutside(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.show();

    mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addValueEventListener(new ValueEventListener(){
    @Override
    public void onDataChange(DataSnapshot dataSnapshot)
    {
    name = dataSnapshot.child("name").getValue().toString();
    email = dataSnapshot.child("email").getValue().toString();
    image = dataSnapshot.child("image").getValue().toString();

    mProgressDialog.dismiss();
    }

    @Override
    public void onCancelled(DatabaseError p1)
    {
    mProgressDialog.dismiss();
    }
    });

    sendmsg();
    }
    return chat;
    }

    @Override
    public void onStart()
    {
    super.onStart();

    if(mAuth.getCurrentUser() != null){
    mChatroomRef.addChildEventListener(new ChildEventListener(){
    @Override
    public void onChildAdded(DataSnapshot data, String s)
    {
    if(data.exists()){
    displayMsg(data);
    }
    }

    @Override
    public void onChildChanged(DataSnapshot data, String s)
    {
    if(data.exists()){
    displayMsg(data);
    }
    }

    @Override
    public void onChildRemoved(DataSnapshot data)
    {
    }

    @Override
    public void onChildMoved(DataSnapshot data, String s)
    {
    }

    @Override
    public void onCancelled(DatabaseError ata)
    {
    }
    });
    }
    }

    private void sendmsg()
    {
    mSend.setOnClickListener(new OnClickListener(){
    @Override
    public void onClick(View v)
    {
    String msg = mMsgInput.getText().toString();

    HashMap<String, Object> mHashmapS = new HashMap<String, Object>();
    mChatroomRef.updateChildren(mHashmapS);
    String mMessageKey = mChatroomRef.push().getKey();
    mMessageRef = mChatroomRef.child(mMessageKey);
    HashMap<String, Object> mHashmapMessage = new HashMap<String, Object>();
    mHashmapMessage.put("name", name);
    mHashmapMessage.put("msg", msg);
    mMessageRef.updateChildren(mHashmapMessage);

    mMsgInput.setText("");

    Toast.makeText(getActivity(), "Message sent successfully...", Toast.LENGTH_SHORT).show();
    }
    });
    }

    private void displayMsg(DataSnapshot data)
    {
    Iterator it = data.getChildren().iterator();
    while(it.hasNext()){
    String msgMsg = (String) ((DataSnapshot) it.next()).getValue();
    String msgName = (String) ((DataSnapshot) it.next()).getValue();

    LayoutInflater mInflator = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View mView = mInflator.inflate(R.layout.item_msg, null);
    TextView mMsgView = (TextView) mView.findViewById(R.id.item_msgTVMsg);
    mMsgView.append(msgName + " :n" + msgMsg + "n ");
    mMsgContainerTv.addView(mView, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    mMsgContainer.fullScroll(ScrollView.FOCUS_DOWN);
    }
    }
    }


    My database structure :
    chatroom >> messagekey >> 1. msg, 2. name



    In my application i got multiple times same msg and name



    And also i want data in way it is in database structure into the my app.










    share|improve this question



























      0












      0








      0








      i am recently created an app which is still in development.
      In need your help because, whenever i get data from firebase database i comes single data in multiple times. Look below my code, database where you get my question properly and you also get what i'm trying to say.



      My code :



      public class FragmentChat extends Fragment
      {
      EditText mMsgInput;
      Button mSend;
      LinearLayout mMsgContainerTv;
      ScrollView mMsgContainer;
      ProgressDialog mProgressDialog;

      String name, email, image;

      FirebaseAuth mAuth;
      DatabaseReference mDataRef, mChatroomRef, mMessageRef;

      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
      super.onCreateView(inflater, container, savedInstanceState);

      View chat = inflater.inflate(R.layout.fragment_chat, container, false);

      mMsgInput = (EditText) chat.findViewById(R.id.fragment_chatETMsg);
      mSend = (Button) chat.findViewById(R.id.fragment_chatBTSend);
      mMsgContainerTv = (LinearLayout) chat.findViewById(R.id.fragment_chatLLMsgContainer);
      mMsgContainer = (ScrollView) chat.findViewById(R.id.fragment_chatSVMsgContainer);

      mAuth = FirebaseAuth.getInstance();
      mDataRef = FirebaseDatabase.getInstance().getReference();
      mChatroomRef = FirebaseDatabase.getInstance().getReference().child("Chatroom");

      if(mAuth.getCurrentUser() == null){
      Toast.makeText(getActivity(), "Please Login First", Toast.LENGTH_SHORT).show();
      }else{
      mProgressDialog = new ProgressDialog(getActivity());
      mProgressDialog.setTitle("Loading data...");
      mProgressDialog.setMessage("Please wait while we load your data into activity...");
      mProgressDialog.setCanceledOnTouchOutside(false);
      mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      mProgressDialog.show();

      mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addValueEventListener(new ValueEventListener(){
      @Override
      public void onDataChange(DataSnapshot dataSnapshot)
      {
      name = dataSnapshot.child("name").getValue().toString();
      email = dataSnapshot.child("email").getValue().toString();
      image = dataSnapshot.child("image").getValue().toString();

      mProgressDialog.dismiss();
      }

      @Override
      public void onCancelled(DatabaseError p1)
      {
      mProgressDialog.dismiss();
      }
      });

      sendmsg();
      }
      return chat;
      }

      @Override
      public void onStart()
      {
      super.onStart();

      if(mAuth.getCurrentUser() != null){
      mChatroomRef.addChildEventListener(new ChildEventListener(){
      @Override
      public void onChildAdded(DataSnapshot data, String s)
      {
      if(data.exists()){
      displayMsg(data);
      }
      }

      @Override
      public void onChildChanged(DataSnapshot data, String s)
      {
      if(data.exists()){
      displayMsg(data);
      }
      }

      @Override
      public void onChildRemoved(DataSnapshot data)
      {
      }

      @Override
      public void onChildMoved(DataSnapshot data, String s)
      {
      }

      @Override
      public void onCancelled(DatabaseError ata)
      {
      }
      });
      }
      }

      private void sendmsg()
      {
      mSend.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View v)
      {
      String msg = mMsgInput.getText().toString();

      HashMap<String, Object> mHashmapS = new HashMap<String, Object>();
      mChatroomRef.updateChildren(mHashmapS);
      String mMessageKey = mChatroomRef.push().getKey();
      mMessageRef = mChatroomRef.child(mMessageKey);
      HashMap<String, Object> mHashmapMessage = new HashMap<String, Object>();
      mHashmapMessage.put("name", name);
      mHashmapMessage.put("msg", msg);
      mMessageRef.updateChildren(mHashmapMessage);

      mMsgInput.setText("");

      Toast.makeText(getActivity(), "Message sent successfully...", Toast.LENGTH_SHORT).show();
      }
      });
      }

      private void displayMsg(DataSnapshot data)
      {
      Iterator it = data.getChildren().iterator();
      while(it.hasNext()){
      String msgMsg = (String) ((DataSnapshot) it.next()).getValue();
      String msgName = (String) ((DataSnapshot) it.next()).getValue();

      LayoutInflater mInflator = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View mView = mInflator.inflate(R.layout.item_msg, null);
      TextView mMsgView = (TextView) mView.findViewById(R.id.item_msgTVMsg);
      mMsgView.append(msgName + " :n" + msgMsg + "n ");
      mMsgContainerTv.addView(mView, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

      mMsgContainer.fullScroll(ScrollView.FOCUS_DOWN);
      }
      }
      }


      My database structure :
      chatroom >> messagekey >> 1. msg, 2. name



      In my application i got multiple times same msg and name



      And also i want data in way it is in database structure into the my app.










      share|improve this question
















      i am recently created an app which is still in development.
      In need your help because, whenever i get data from firebase database i comes single data in multiple times. Look below my code, database where you get my question properly and you also get what i'm trying to say.



      My code :



      public class FragmentChat extends Fragment
      {
      EditText mMsgInput;
      Button mSend;
      LinearLayout mMsgContainerTv;
      ScrollView mMsgContainer;
      ProgressDialog mProgressDialog;

      String name, email, image;

      FirebaseAuth mAuth;
      DatabaseReference mDataRef, mChatroomRef, mMessageRef;

      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
      super.onCreateView(inflater, container, savedInstanceState);

      View chat = inflater.inflate(R.layout.fragment_chat, container, false);

      mMsgInput = (EditText) chat.findViewById(R.id.fragment_chatETMsg);
      mSend = (Button) chat.findViewById(R.id.fragment_chatBTSend);
      mMsgContainerTv = (LinearLayout) chat.findViewById(R.id.fragment_chatLLMsgContainer);
      mMsgContainer = (ScrollView) chat.findViewById(R.id.fragment_chatSVMsgContainer);

      mAuth = FirebaseAuth.getInstance();
      mDataRef = FirebaseDatabase.getInstance().getReference();
      mChatroomRef = FirebaseDatabase.getInstance().getReference().child("Chatroom");

      if(mAuth.getCurrentUser() == null){
      Toast.makeText(getActivity(), "Please Login First", Toast.LENGTH_SHORT).show();
      }else{
      mProgressDialog = new ProgressDialog(getActivity());
      mProgressDialog.setTitle("Loading data...");
      mProgressDialog.setMessage("Please wait while we load your data into activity...");
      mProgressDialog.setCanceledOnTouchOutside(false);
      mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      mProgressDialog.show();

      mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addValueEventListener(new ValueEventListener(){
      @Override
      public void onDataChange(DataSnapshot dataSnapshot)
      {
      name = dataSnapshot.child("name").getValue().toString();
      email = dataSnapshot.child("email").getValue().toString();
      image = dataSnapshot.child("image").getValue().toString();

      mProgressDialog.dismiss();
      }

      @Override
      public void onCancelled(DatabaseError p1)
      {
      mProgressDialog.dismiss();
      }
      });

      sendmsg();
      }
      return chat;
      }

      @Override
      public void onStart()
      {
      super.onStart();

      if(mAuth.getCurrentUser() != null){
      mChatroomRef.addChildEventListener(new ChildEventListener(){
      @Override
      public void onChildAdded(DataSnapshot data, String s)
      {
      if(data.exists()){
      displayMsg(data);
      }
      }

      @Override
      public void onChildChanged(DataSnapshot data, String s)
      {
      if(data.exists()){
      displayMsg(data);
      }
      }

      @Override
      public void onChildRemoved(DataSnapshot data)
      {
      }

      @Override
      public void onChildMoved(DataSnapshot data, String s)
      {
      }

      @Override
      public void onCancelled(DatabaseError ata)
      {
      }
      });
      }
      }

      private void sendmsg()
      {
      mSend.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View v)
      {
      String msg = mMsgInput.getText().toString();

      HashMap<String, Object> mHashmapS = new HashMap<String, Object>();
      mChatroomRef.updateChildren(mHashmapS);
      String mMessageKey = mChatroomRef.push().getKey();
      mMessageRef = mChatroomRef.child(mMessageKey);
      HashMap<String, Object> mHashmapMessage = new HashMap<String, Object>();
      mHashmapMessage.put("name", name);
      mHashmapMessage.put("msg", msg);
      mMessageRef.updateChildren(mHashmapMessage);

      mMsgInput.setText("");

      Toast.makeText(getActivity(), "Message sent successfully...", Toast.LENGTH_SHORT).show();
      }
      });
      }

      private void displayMsg(DataSnapshot data)
      {
      Iterator it = data.getChildren().iterator();
      while(it.hasNext()){
      String msgMsg = (String) ((DataSnapshot) it.next()).getValue();
      String msgName = (String) ((DataSnapshot) it.next()).getValue();

      LayoutInflater mInflator = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View mView = mInflator.inflate(R.layout.item_msg, null);
      TextView mMsgView = (TextView) mView.findViewById(R.id.item_msgTVMsg);
      mMsgView.append(msgName + " :n" + msgMsg + "n ");
      mMsgContainerTv.addView(mView, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

      mMsgContainer.fullScroll(ScrollView.FOCUS_DOWN);
      }
      }
      }


      My database structure :
      chatroom >> messagekey >> 1. msg, 2. name



      In my application i got multiple times same msg and name



      And also i want data in way it is in database structure into the my app.







      android android-fragments firebase-realtime-database






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 17 '18 at 15:16









      Frank van Puffelen

      233k29380406




      233k29380406










      asked Nov 17 '18 at 4:55









      Rakesh BhagatRakesh Bhagat

      32




      32
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If you want to read the user profile information only once, use addListenerForSingleValueEvent instead of addValueEventListener. So:



          mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener(){


          Also see the Firebase documentation on reading data once.






          share|improve this answer
























          • But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

            – Rakesh Bhagat
            Nov 17 '18 at 15:39











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348355%2fi-got-multiple-times-same-data-from-firebase-database-i-need-only-once-from-fir%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If you want to read the user profile information only once, use addListenerForSingleValueEvent instead of addValueEventListener. So:



          mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener(){


          Also see the Firebase documentation on reading data once.






          share|improve this answer
























          • But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

            – Rakesh Bhagat
            Nov 17 '18 at 15:39
















          0














          If you want to read the user profile information only once, use addListenerForSingleValueEvent instead of addValueEventListener. So:



          mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener(){


          Also see the Firebase documentation on reading data once.






          share|improve this answer
























          • But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

            – Rakesh Bhagat
            Nov 17 '18 at 15:39














          0












          0








          0







          If you want to read the user profile information only once, use addListenerForSingleValueEvent instead of addValueEventListener. So:



          mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener(){


          Also see the Firebase documentation on reading data once.






          share|improve this answer













          If you want to read the user profile information only once, use addListenerForSingleValueEvent instead of addValueEventListener. So:



          mDataRef.child("Users").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener(){


          Also see the Firebase documentation on reading data once.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 17 '18 at 15:17









          Frank van PuffelenFrank van Puffelen

          233k29380406




          233k29380406













          • But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

            – Rakesh Bhagat
            Nov 17 '18 at 15:39



















          • But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

            – Rakesh Bhagat
            Nov 17 '18 at 15:39

















          But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

          – Rakesh Bhagat
          Nov 17 '18 at 15:39





          But i'm using, push child key to create new child and get data from there. while receiving data i dont have child key.

          – Rakesh Bhagat
          Nov 17 '18 at 15:39


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348355%2fi-got-multiple-times-same-data-from-firebase-database-i-need-only-once-from-fir%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini