Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. package com.serviya.ti.serviyapp;
  2.  
  3. @Override
  4. protected void onCreate(Bundle savedInstanceState) {
  5. super.onCreate(savedInstanceState);
  6. setContentView(R.layout.activity_form_negocio);
  7.  
  8. nombren = (EditText)findViewById(R.id.nombren);
  9. telefonon = (EditText)findViewById(R.id.telefonon);
  10. direccionnR = (EditText)findViewById(R.id.direccionnR);
  11. direccionnE = (EditText)findViewById(R.id.direccionnE);
  12. correon = (EditText)findViewById(R.id.correon);
  13. observacionesn = (EditText)findViewById(R.id.observacionesn);
  14.  
  15. tespecial = (RadioButton)findViewById(R.id.tespecial);
  16. carga = (RadioButton)findViewById(R.id.carga);
  17. encomiendan = (RadioButton)findViewById(R.id.encomiendan);
  18.  
  19. confirmarnform = (Button)findViewById(R.id.confirmarNform);
  20. regresarnform = (Button)findViewById(R.id.regresarNform);
  21.  
  22. confirmarnform.setOnClickListener(new View.OnClickListener() {
  23. @Override
  24. public void onClick(View v) {
  25.  
  26.  
  27. if (tespecial.isChecked()){
  28. tipon = "T. Especial";
  29. }else if (carga.isChecked()){
  30. tipon = "carga";
  31. }else if (encomiendan.isChecked()){
  32. tipon = "encomienda";
  33. }
  34.  
  35. final String nombreform = nombren.getText().toString().trim();
  36.  
  37. String registro = "http://miurl.com/micarpeta/registrarn.php?idusuarion=NULL&nombren="+nombreform+"&telefonon="+telefonon.getText()+"&direccionnR="+direccionnR.getText()+"&direccionnE="+direccionnE.getText()+"&correon="+correon.getText()+"&tipon="+tipon+"&observacionesn="+observacionesn.getText();
  38.  
  39. EnviarRecibirDatos(registro);
  40. Intent confirmarnform = new Intent(FormNegocio.this, Fin.class);
  41. startActivity(confirmarnform);
  42. }
  43. });
  44.  
  45.  
  46. regresarnform.setOnClickListener(new View.OnClickListener() {
  47. @Override
  48. public void onClick(View v) {
  49. Intent regresarnform = new Intent(FormNegocio.this, Inicio.class);
  50. startActivity(regresarnform);
  51. }
  52. });
  53. }
  54.  
  55. public void EnviarRecibirDatos(String URL){
  56.  
  57. Toast.makeText(getApplicationContext(), "Tenemos tu solicitud", Toast.LENGTH_SHORT).show();
  58.  
  59.  
  60. RequestQueue queue = Volley.newRequestQueue(this);
  61. StringRequest stringRequest = new StringRequest(Request.Method.GET, URL, new Response.Listener<String>() {
  62. @Override
  63. public void onResponse(String response) {
  64.  
  65.  
  66. if (response.length()>0){
  67. try {
  68. JSONArray ja = new JSONArray(response);
  69. Log.i("sizejson",""+ja.length());
  70.  
  71. } catch (JSONException e) {
  72. e.printStackTrace();
  73. }
  74.  
  75. }
  76.  
  77. }
  78. }, new Response.ErrorListener(){
  79. @Override
  80. public void onErrorResponse(VolleyError error) {
  81.  
  82. }
  83. });
  84.  
  85. queue.add(stringRequest);
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement