title: Correct use of Volley in an activity with Android Studio
body: <p>I've been thinking about the correct use of context cause I have a problem when I use <code>Volley.newRequestQueue(getBaseContext());</code></p>
  
  <p>I don't know the correct context that I have to use, I've watched a tutorial and in the video the man use a <code>Fragment</code> but I am using an <code>Activity</code> so its diferent and also the same autor of the video wrote that we had to change the context if we want to use the same code in an <code>Activity</code>.</p>
  
  <p>I've tried with:</p>
  
  <ul>
  <li><code>getAplicationcontext()</code></li>
  <li><code>getContext()</code></li>
  <li><code>getBasedContext()</code></li>
  <li><code>getAplication()</code></li>
  </ul>
  
  <p>The worst it's that my aplication doesn´t tell the error, it said: <code>it has found the user: asd@gmalcom</code>, that means that aparently registration is succesfull but when I see the database there is nothing...</p>
  
  <pre><code>public class another extends AppCompatActivity implements 
  Response.Listener&lt;JSONObject&gt;,Response.ErrorListener{
  
  RequestQueue rq;
  JsonRequest jrqt;
  EditText txtnombre,txtapellido,txtcel,txtCorreo,txtContra,txtRecontraReg;
  Button btnIngresar;
  TextView txtCrear,txtolvido;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_another);
      txtnombre=(EditText) findViewById(R.id.edtxtnomReg);
      txtapellido=(EditText) findViewById(R.id.edtxtApellReg);
      txtcel=(EditText) findViewById(R.id.edtxtCelReg);
      txtContra=(EditText) findViewById(R.id.edtxtContraReg);
      txtCorreo=(EditText) findViewById(R.id.edtxtCorreoReg);
      btnIngresar=(Button) findViewById(R.id.btnReg);
      txtCrear=(TextView) findViewById(R.id.txtCrearCuenta);
      txtolvido=(TextView) findViewById(R.id.txtcontraOlvidadLog);
      //revisar esto
      **rq=Volley.newRequestQueue(getBaseContext());**
  
      btnIngresar.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              registrar_usuario();
          }
      });
  
  }
  
  private void registrar_usuario() {
      String urli="http://*************************************.php? 
              nombre_cli="+txtnombre.getText().toString()+
              "&amp;apellido_cli="+txtContra.getText().toString()+
              "&amp;correo_cli="+txtCorreo.getText().toString()+
              "&amp;celular_cli="+txtcel.getText().toString()+
              "&amp;contrasena_cli="+txtContra.getText().toString();
      jrqt=new JsonObjectRequest(Request.Method.GET,urli,null,this,this);
      rq.add(jrqt);
  }
  
  @Override
  public void onErrorResponse(VolleyError error) {
      Toast.makeText(this,"No se pudo registrar el usuario 
  "+error.toString(),Toast.LENGTH_SHORT).show();
  }
  
  @Override
  public void onResponse(JSONObject response) {
      Clientes cli=new Clientes();
      Toast.makeText(this,"Se ha encontrado el 
  usuario"+txtCorreo.getText().toString(),Toast.LENGTH_SHORT).show();
  
      //limpiartextview();
  }
  
  private void limpiartextview() {
      txtnombre.setText("");
      txtapellido.setText("");
      txtCorreo.setText("");
      txtcel.setText("");
      txtContra.setText("");
  }
  }
  </code></pre>