title: How to delete data(particular node of json) from realtime database in Firebase in android app
body: <p>I build a Todo list app in that i have onClick listener (named as delteTask).I want  to remove my data in firebase when the delete button is clicked.I have got the database refrence as i checked in documentation that to delete a node you can make use of removeValue() method.But i don't understand how to use it.I have written the code as well,Please help me in this.</p>
  
  <pre><code>**MY MAINACTIVTY&gt;JAVA**
  package com.example.manuj.todolist;
  
  import android.content.DialogInterface;
  import android.support.v7.app.AlertDialog;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.firebase.database.ChildEventListener;
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.ValueEventListener;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  public class MainActivity extends AppCompatActivity {
  
      String tasks;
  
      FirebaseDatabase db=FirebaseDatabase.getInstance();
      DatabaseReference rootRef=db.getReference();
      DatabaseReference dataRef=rootRef.child("Todo");
  
  
      TextView textView;
      Button button;
      ListView listView;
      ArrayAdapter mAdapter;
  
      ArrayList&lt;String&gt; arrayList=new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          button=findViewById(R.id.button);
          textView=findViewById(R.id.textView);
          listView=findViewById(R.id.listView);
  
  
          mAdapter=new ArrayAdapter&lt;String&gt;(this,R.layout.list_item,R.id.textView,arrayList);
          listView.setAdapter(mAdapter);
  
  
          dataRef.addChildEventListener(new ChildEventListener() {
              @Override
              public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                  String value=dataSnapshot.getValue().toString();
                  try {
                      JSONObject object=new JSONObject(value);
                      tasks=object.getString("Task");
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
  
                  arrayList.add(tasks);
                  mAdapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildChanged(DataSnapshot dataSnapshot, String s) {
  
              }
  
              @Override
              public void onChildRemoved(DataSnapshot dataSnapshot) {
  
              }
  
              @Override
              public void onChildMoved(DataSnapshot dataSnapshot, String s) {
  
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  
  
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu,menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item){
          switch(item.getItemId()){
              case R.id.addTask:
                  final EditText editText=new EditText(this);
                  AlertDialog dialog=new AlertDialog.Builder(this)
                          .setTitle("Add new Task")
                          .setMessage("What's your Task?")
                          .setView(editText)
                          .setPositiveButton("Add", new DialogInterface.OnClickListener() {
                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                  String task= editText.getText().toString();
                                  HashMap&lt;String,String&gt; todoMap=new HashMap&lt;String, String&gt;();
                                  todoMap.put("Task",task);
                                  dataRef.push().setValue(todoMap);
  
                              }
                          })
                          .setNegativeButton("CANCEL",null).create();
                  dialog.show();
                  return true;
          }
          return super.onOptionsItemSelected(item);
  
      }
      public void deleteTask(View view) {
  
          DatabaseReference removeRef=FirebaseDatabase.getInstance().getReference("Todo");
          removeRef.removeValue();//the problem i n using the above is it removes my all data,but how
          //do i  remove a particular.
  
      }
  }
  </code></pre>