Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. public void goToSincronizar2(View view) {
  2. DatabaseHelper myDb;
  3. // al crear el objeto myDb ejecutamos las sentencias, para crear las tablas necesarias
  4. myDb = new DatabaseHelper(this);
  5. myDb.init();
  6. Cursor res = myDb.extraeconfig();
  7. String xUrl = "";
  8. String xUser = "";
  9. String xPass = "";
  10. String xCatalogo = "";
  11. if (res != null && res.getCount() > 0) {
  12. res.moveToFirst();
  13. xUrl = res.getString(res.getColumnIndex("dburl")) + res.getString(res.getColumnIndex("dbdatabase"));
  14. xUser = res.getString(res.getColumnIndex("dbuser"));
  15. xPass = res.getString(res.getColumnIndex("dbpass"));
  16. xCatalogo = "cFrigorificos";
  17. } else {
  18. Toast.makeText(this, "ERROR archivo de configuracion (swItsol.db)", Toast.LENGTH_LONG).show();
  19. }
  20. HashMap<String, String> params = new HashMap<>();
  21. params.put("xCatalogo", xCatalogo);
  22. params.put("xUrl", xUrl);
  23. params.put("xUser", xUser);
  24. params.put("xPass", xPass);
  25.  
  26. final String XxCatalogo = xCatalogo;
  27. final String XxUrl = xUrl;
  28. final String XxUser = xUser;
  29. final String XxPass = xPass;
  30. JsonObjectRequest js = new JsonObjectRequest(
  31. Request.Method.POST,
  32. "http://192.168.0.10:8080/jinvmanz/wwwcatalogosMobiles/extraecatalogos.jsp",
  33. null,
  34. new Response.Listener<JSONObject>() {
  35. @Override
  36. public void onResponse(JSONObject response) {
  37. Log.d("tag", "User creation completed successfully");
  38. }
  39. },
  40. new Response.ErrorListener() {
  41. @Override
  42. public void onErrorResponse(VolleyError error) {
  43. Log.i("tag", "error 404 " + error.getMessage());
  44.  
  45. }
  46. }) {
  47. @Override
  48. protected Map<String, String> getParams() throws AuthFailureError {
  49. HashMap<String, String> params = new HashMap<>();
  50. params.put("xCatalogo", XxCatalogo);
  51. params.put("xUrl", XxUrl);
  52. params.put("xUser", XxUser);
  53. params.put("xPass", XxPass);
  54. return params;
  55. }
  56. };
  57. RequestQueue queue = Volley.newRequestQueue(actMenu.this);
  58. queue.add(js);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement