Guest User

444

a guest
Dec 16th, 2015
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.66 KB | None | 0 0
  1. package com.example.kingsrobot.sigilov12;
  2.  
  3. import android.app.AlertDialog;
  4. import android.content.DialogInterface;
  5. import android.content.Intent;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.os.Bundle;
  8. import android.view.View;
  9. import android.widget.ArrayAdapter;
  10. import android.widget.Button;
  11. import android.widget.EditText;
  12. import android.widget.ImageButton;
  13. import android.widget.ListView;
  14.  
  15. import com.loopj.android.http.AsyncHttpClient;
  16. import com.loopj.android.http.AsyncHttpResponseHandler;
  17. import com.loopj.android.http.RequestParams;
  18.  
  19. import org.json.JSONArray;
  20.  
  21. import java.util.ArrayList;
  22.  
  23. import cz.msebera.android.httpclient.Header;
  24.  
  25. public class Principal extends AppCompatActivity implements View.OnClickListener {
  26.  
  27.  
  28. // VARIABLE GLOBALES
  29. EditText usuariotxt, contrasenatxt;
  30. Button btnlogin;
  31. ListView listado;
  32. String password;
  33. ArrayList listanit,listanombre,listapass,listacliente,listarmas,listaradio,listaguarda;
  34. int posicion;
  35. String namename;
  36. String nombref;
  37. String usuario;
  38. int checkpass;
  39.  
  40. // FIN VARIABLES GLOBALES
  41.  
  42. /////////////////////////////////////////////VERIFICAR INICIO///////////////////////////////////////////////////////////////////////
  43. public boolean verificarinicio() {
  44.  
  45.  
  46.  
  47. if (listanit.contains(usuariotxt.getText().toString())) {
  48.  
  49.  
  50.  
  51. usuario = usuariotxt.getText().toString();
  52. //int retval=arrlist.IndexOf("E");
  53. posicion=listanit.indexOf(usuario);
  54. namename=listanombre.get(posicion).toString();
  55. nombref=namename;
  56.  
  57.  
  58. return true;
  59.  
  60.  
  61.  
  62. }else{return false;
  63.  
  64. }
  65.  
  66.  
  67.  
  68.  
  69. }
  70.  
  71. /////////////////////////////////////////////////VERIFICAR INICIO///////////////////////////////////////////////////////////////
  72. /////////////////////////////////////////////VERIFICAR Contraseña///////////////////////////////////////////////////////////////////////
  73.  
  74. public void verificarcontraseña() {
  75.  
  76. password = listapass.get(posicion).toString();
  77. String check = contrasenatxt.getText().toString();
  78.  
  79. if (check.equals(password)) {
  80.  
  81. checkpass=1940;
  82.  
  83. } else {
  84. checkpass=0;
  85. }
  86.  
  87. }
  88.  
  89.  
  90.  
  91. /////////////////////////////////////////////VERIFICAR contraseña///////////////////////////////////////////////////////////////////////
  92.  
  93.  
  94. //////////////////////////////////////////////////////OBTENER DATOS NIT//////////////////////////////////////////////////////////////////
  95. public void CargaLista(ArrayList<String> datos) {
  96.  
  97.  
  98. // Object[] nitvector = datos.toArray();
  99.  
  100.  
  101. ArrayAdapter<String> adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,datos);
  102. listado.setAdapter(adapter);
  103. listanit=datos;
  104.  
  105.  
  106.  
  107.  
  108. }
  109.  
  110. //////////////////////////////////////////////////////OBTENER DATOS NIT//////////////////////////////////////////////////////////////////
  111. /////////////////////////////////////////////////OBTENER DATOS NIT/////////////////////////////////////////////////////////
  112.  
  113. public void obtDatos(){
  114.  
  115. AsyncHttpClient client = new AsyncHttpClient();
  116. //String urlusuario="https://graph.facebook.com/19292868552";
  117. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonUser.php";
  118.  
  119. RequestParams parametros = new RequestParams();
  120. //parametros.put("Edad",18);
  121.  
  122. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  123. @Override
  124. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  125. if (statusCode==200){
  126. //llamar funcion....
  127. CargaLista(obtDatosJSON(new String(responseBody)));
  128.  
  129. }
  130. }
  131.  
  132. @Override
  133. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  134.  
  135. }
  136. });
  137.  
  138.  
  139.  
  140. }
  141.  
  142.  
  143.  
  144. //////////////////////////////////////////////////////OBTENER DATOS NIT//////////////////////////////////////////////////////////////////
  145.  
  146.  
  147. //////////////////////////////////////////////////////OBTENER DATOS NIT//////////////////////////////////////////////////////////////////
  148.  
  149. public ArrayList<String> obtDatosJSON(String response){
  150.  
  151. ArrayList<String> listado = new ArrayList<>();
  152.  
  153. try {
  154. JSONArray jsonArray = new JSONArray(response);
  155. String texto;
  156.  
  157. for (int i=0;i<jsonArray.length();i++){
  158. texto=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  159. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  160. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  161.  
  162.  
  163. listado.add(texto);
  164.  
  165.  
  166.  
  167. }
  168.  
  169. }catch (Exception e){
  170. e.printStackTrace();
  171.  
  172. }
  173. return listado;
  174.  
  175. }
  176.  
  177. //////////////////////////////////////////////////////OBTENER DATOS NIT//////////////////////////////////////////////////////////////////
  178.  
  179. //////////////////////////////////////////////////////OBTENER DATOS NOMBRE//////////////////////////////////////////////////////////////////
  180.  
  181. public ArrayList<String> obtDatosJSON1(String response){
  182.  
  183. ArrayList<String> listado1 = new ArrayList<String>();
  184.  
  185. try {
  186. JSONArray jsonArray = new JSONArray(response);
  187. String texto;
  188.  
  189. for (int i=0;i<jsonArray.length();i++){
  190. texto=jsonArray.getJSONObject(i).getString("Nombre_user");//+ " "+
  191. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  192. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  193.  
  194.  
  195. listado1.add(texto);
  196.  
  197.  
  198.  
  199. }
  200.  
  201. }catch (Exception e){
  202. e.printStackTrace();
  203.  
  204. }
  205. return listado1;
  206.  
  207. }
  208.  
  209. //////////////////////////////////////////////////////OBTENER DATOS NOMBRE//////////////////////////////////////////////////////////////////
  210.  
  211.  
  212. /////////////////////////////////////////////////OBTENER DATOS NOMBRE/////////////////////////////////////////////////////////
  213.  
  214. public void obtDatos1(){
  215.  
  216. AsyncHttpClient client = new AsyncHttpClient();
  217. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonUser.php";
  218.  
  219. RequestParams parametros = new RequestParams();
  220. //parametros.put("Edad",18);
  221.  
  222. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  223. @Override
  224. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  225. if (statusCode==200){
  226. //llamar funcion....
  227. CargaLista1(obtDatosJSON1(new String(responseBody)));
  228.  
  229. }
  230. }
  231.  
  232. @Override
  233. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  234.  
  235. }
  236. });
  237.  
  238.  
  239.  
  240. }
  241.  
  242.  
  243.  
  244. //////////////////////////////////////////////////////OBTENER DATOS NOMBRE//////////////////////////////////////////////////////////////////
  245.  
  246.  
  247. //////////////////////////////////////////////////////OBTENER DATOS NOMBRE//////////////////////////////////////////////////////////////////
  248. public void CargaLista1(ArrayList<String> datos1) {
  249.  
  250.  
  251. // Object[] nitvector = datos.toArray();
  252.  
  253.  
  254. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  255. // listado.setAdapter(adapter);
  256. listanombre=datos1;
  257.  
  258.  
  259.  
  260.  
  261. }
  262. //////////////////////////////////////////////////////OBTENER DATOS NOMBRE//////////////////////////////////////////////////////////////////
  263. //////////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA//////////////////////////////////////////////////////////////////
  264.  
  265. public ArrayList<String> obtDatosJSON2(String response){
  266.  
  267. ArrayList<String> listado2 = new ArrayList<String>();
  268.  
  269. try {
  270. JSONArray jsonArray = new JSONArray(response);
  271. String texto;
  272.  
  273. for (int i=0;i<jsonArray.length();i++){
  274. texto=jsonArray.getJSONObject(i).getString("pass_user");//+ " "+
  275. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  276. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  277.  
  278.  
  279. listado2.add(texto);
  280.  
  281.  
  282.  
  283. }
  284.  
  285. }catch (Exception e){
  286. e.printStackTrace();
  287.  
  288. }
  289. return listado2;
  290.  
  291. }
  292.  
  293. //////////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA//////////////////////////////////////////////////////////////////
  294.  
  295.  
  296. /////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA/////////////////////////////////////////////////////////
  297.  
  298. public void obtDatos2(){
  299.  
  300. AsyncHttpClient client = new AsyncHttpClient();
  301. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonUser.php";
  302.  
  303. RequestParams parametros = new RequestParams();
  304. //parametros.put("Edad",18);
  305.  
  306. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  307. @Override
  308. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  309. if (statusCode==200){
  310. //llamar funcion....
  311. CargaLista2(obtDatosJSON2(new String(responseBody)));
  312.  
  313. }
  314. }
  315.  
  316. @Override
  317. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  318.  
  319. }
  320. });
  321.  
  322.  
  323.  
  324. }
  325.  
  326.  
  327.  
  328. //////////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA//////////////////////////////////////////////////////////////////
  329.  
  330.  
  331. //////////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA//////////////////////////////////////////////////////////////////
  332. public void CargaLista2(ArrayList<String> datos2) {
  333.  
  334.  
  335. // Object[] nitvector = datos.toArray();
  336.  
  337.  
  338. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  339. // listado.setAdapter(adapter);
  340. listapass=datos2;
  341.  
  342.  
  343.  
  344.  
  345. }
  346. //////////////////////////////////////////////////////OBTENER DATOS CONTRASEÑA//////////////////////////////////////////////////////////////////
  347. //***************************************
  348. //////////////////////////////////////////////////////OBTENER DATOS CLIENTE//////////////////////////////////////////////////////////////////
  349.  
  350. public ArrayList<String> obtDatosJSON3(String response){
  351.  
  352. ArrayList<String> listado3 = new ArrayList<String>();
  353.  
  354. try {
  355. JSONArray jsonArray = new JSONArray(response);
  356. String texto;
  357.  
  358. for (int i=0;i<jsonArray.length();i++){
  359. texto=jsonArray.getJSONObject(i).getString("nombre");//+ " "+
  360. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  361. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  362.  
  363.  
  364. listado3.add(texto);
  365.  
  366.  
  367.  
  368. }
  369.  
  370. }catch (Exception e){
  371. e.printStackTrace();
  372.  
  373. }
  374. return listado3;
  375.  
  376. }
  377.  
  378. //////////////////////////////////////////////////////OBTENER DATOS CLIENTE//////////////////////////////////////////////////////////////////
  379.  
  380.  
  381. /////////////////////////////////////////////////OBTENER DATOS CLIENTE/////////////////////////////////////////////////////////
  382.  
  383. public void obtDatos3(){
  384.  
  385. AsyncHttpClient client = new AsyncHttpClient();
  386. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonPuesto.php";
  387.  
  388. RequestParams parametros = new RequestParams();
  389. //parametros.put("Edad",18);
  390.  
  391. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  392. @Override
  393. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  394. if (statusCode==200){
  395. //llamar funcion....
  396. CargaLista3(obtDatosJSON3(new String(responseBody)));
  397.  
  398. }
  399. }
  400.  
  401. @Override
  402. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  403.  
  404. }
  405. });
  406.  
  407.  
  408.  
  409. }
  410.  
  411.  
  412.  
  413. //////////////////////////////////////////////////////OBTENER DATOS CLIENTE//////////////////////////////////////////////////////////////////
  414.  
  415.  
  416. //////////////////////////////////////////////////////OBTENER DATOS CLIENTE//////////////////////////////////////////////////////////////////
  417. public void CargaLista3(ArrayList<String> datos3) {
  418.  
  419.  
  420. // Object[] nitvector = datos.toArray();
  421.  
  422.  
  423. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  424. // listado.setAdapter(adapter);
  425. listacliente=datos3;
  426.  
  427.  
  428.  
  429.  
  430. }
  431. //////////////////////////////////////////////////////OBTENER DATOS CLIENTE//////////////////////////////////////////////////////////////////
  432.  
  433. //////////////////////////////////////////////////////OBTENER DATOS CARMAS//////////////////////////////////////////////////////////////////
  434.  
  435. public ArrayList<String> obtDatosJSON4(String response){
  436.  
  437. ArrayList<String> listado4 = new ArrayList<String>();
  438.  
  439. try {
  440. JSONArray jsonArray = new JSONArray(response);
  441. String texto;
  442.  
  443. for (int i=0;i<jsonArray.length();i++){
  444. texto=jsonArray.getJSONObject(i).getString("nombre");//+ " "+
  445. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  446. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  447.  
  448.  
  449. listado4.add(texto);
  450.  
  451.  
  452.  
  453. }
  454.  
  455. }catch (Exception e){
  456. e.printStackTrace();
  457.  
  458. }
  459. return listado4;
  460.  
  461. }
  462.  
  463. //////////////////////////////////////////////////////OBTENER DATOS ARMAS//////////////////////////////////////////////////////////////////
  464.  
  465.  
  466. /////////////////////////////////////////////////OBTENER DATOS ARMAS/////////////////////////////////////////////////////////
  467.  
  468. public void obtDatos4(){
  469.  
  470. AsyncHttpClient client = new AsyncHttpClient();
  471. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonArma.php";
  472.  
  473. RequestParams parametros = new RequestParams();
  474. //parametros.put("Edad",18);
  475.  
  476. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  477. @Override
  478. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  479. if (statusCode==200){
  480. //llamar funcion....
  481. CargaLista4(obtDatosJSON4(new String(responseBody)));
  482.  
  483. }
  484. }
  485.  
  486. @Override
  487. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  488.  
  489. }
  490. });
  491.  
  492.  
  493.  
  494. }
  495.  
  496.  
  497.  
  498. //////////////////////////////////////////////////////OBTENER DATOS ARMAS//////////////////////////////////////////////////////////////////
  499.  
  500.  
  501. //////////////////////////////////////////////////////OBTENER DATOS ARMAS//////////////////////////////////////////////////////////////////
  502. public void CargaLista4(ArrayList<String> datos4) {
  503.  
  504.  
  505. // Object[] nitvector = datos.toArray();
  506.  
  507.  
  508. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  509. // listado.setAdapter(adapter);
  510. listarmas=datos4;
  511.  
  512.  
  513.  
  514.  
  515. }
  516. //////////////////////////////////////////////////////OBTENER DATOS ARMAS//////////////////////////////////////////////////////////////////
  517.  
  518. //////////////////////////////////////////////////////OBTENER DATOS RADIO//////////////////////////////////////////////////////////////////
  519.  
  520. public ArrayList<String> obtDatosJSON5(String response){
  521.  
  522. ArrayList<String> listado5 = new ArrayList<String>();
  523.  
  524. try {
  525. JSONArray jsonArray = new JSONArray(response);
  526. String texto;
  527.  
  528. for (int i=0;i<jsonArray.length();i++){
  529. texto=jsonArray.getJSONObject(i).getString("nombre");//+ " "+
  530. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  531. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  532.  
  533.  
  534. listado5.add(texto);
  535.  
  536.  
  537.  
  538. }
  539.  
  540. }catch (Exception e){
  541. e.printStackTrace();
  542.  
  543. }
  544. return listado5;
  545.  
  546. }
  547.  
  548. //////////////////////////////////////////////////////OBTENER DATOS RADIO/////////////////////////////////////////////////////////////////
  549.  
  550.  
  551. /////////////////////////////////////////////////OBTENER DATOS RADIO////////////////////////////////////////////////////////
  552.  
  553. public void obtDatos5(){
  554.  
  555. AsyncHttpClient client = new AsyncHttpClient();
  556. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonRadio.php";
  557.  
  558. RequestParams parametros = new RequestParams();
  559. //parametros.put("Edad",18);
  560.  
  561. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  562. @Override
  563. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  564. if (statusCode==200){
  565. //llamar funcion....
  566. CargaLista5(obtDatosJSON5(new String(responseBody)));
  567.  
  568. }
  569. }
  570.  
  571. @Override
  572. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  573.  
  574. }
  575. });
  576.  
  577.  
  578.  
  579. }
  580.  
  581.  
  582.  
  583. //////////////////////////////////////////////////////OBTENER DATOS RADIO//////////////////////////////////////////////////////////////////
  584.  
  585.  
  586. //////////////////////////////////////////////////////OBTENER DATOS RADIO//////////////////////////////////////////////////////////////////
  587. public void CargaLista5(ArrayList<String> datos5) {
  588.  
  589.  
  590. // Object[] nitvector = datos.toArray();
  591.  
  592.  
  593. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  594. // listado.setAdapter(adapter);
  595. listaradio=datos5;
  596.  
  597.  
  598.  
  599.  
  600. }
  601. //////////////////////////////////////////////////////OBTENER DATOS RADIO//////////////////////////////////////////////////////////////////
  602.  
  603. //////////////////////////////////////////////////////OBTENER DATOS GUARDA////////////////////////////////////////////////////////////////
  604.  
  605. public ArrayList<String> obtDatosJSON6(String response){
  606.  
  607. ArrayList<String> listado6 = new ArrayList<String>();
  608.  
  609. try {
  610. JSONArray jsonArray = new JSONArray(response);
  611. String texto;
  612.  
  613. for (int i=0;i<jsonArray.length();i++){
  614. texto=jsonArray.getJSONObject(i).getString("nombre");//+ " "+
  615. //nit=jsonArray.getJSONObject(i).getString("Nit_user");//+ " "+
  616. // clave=jsonArray.getJSONObject(i).getString("pass_user");//+ " ";
  617.  
  618.  
  619. listado6.add(texto);
  620.  
  621.  
  622.  
  623. }
  624.  
  625. }catch (Exception e){
  626. e.printStackTrace();
  627.  
  628. }
  629. return listado6;
  630.  
  631. }
  632.  
  633. //////////////////////////////////////////////////////OBTENER DATOS GUARDA///////////////////////////////////////////////////////////
  634.  
  635.  
  636. /////////////////////////////////////////////////OBTENER DATOS GUARDA//////////////////////////////////////////////////
  637. public void obtDatos6(){
  638.  
  639. AsyncHttpClient client = new AsyncHttpClient();
  640. String urlusuario="http://192.168.1.52/cotraser/asdfghjklqwertyuiozxcvbnm/jsonGuarda.php";
  641.  
  642. RequestParams parametros = new RequestParams();
  643. //parametros.put("Edad",18);
  644.  
  645. client.post(urlusuario, parametros, new AsyncHttpResponseHandler() {
  646. @Override
  647. public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
  648. if (statusCode==200){
  649. //llamar funcion....
  650. CargaLista6(obtDatosJSON6(new String(responseBody)));
  651.  
  652. }
  653. }
  654.  
  655. @Override
  656. public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  657.  
  658. }
  659. });
  660.  
  661.  
  662.  
  663. }
  664.  
  665.  
  666.  
  667. //////////////////////////////////////////////////////OBTENER DATOS GUARDA////////////////////////////////////////////////////////////////
  668.  
  669.  
  670. //////////////////////////////////////////////////////OBTENER DATOS GUARDA//////////////////////////////////////////////////////////////////
  671. public void CargaLista6(ArrayList<String> datos6) {
  672.  
  673.  
  674. // Object[] nitvector = datos.toArray();
  675.  
  676.  
  677. // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,datos);
  678. // listado.setAdapter(adapter);
  679. listaguarda=datos6;
  680.  
  681.  
  682.  
  683.  
  684. }
  685. //////////////////////////////////////////////////////OBTENER DATOS GUARDA//////////////////////////////////////////////////////////////////
  686.  
  687.  
  688. @Override
  689. protected void onCreate(Bundle savedInstanceState) {
  690. super.onCreate(savedInstanceState);
  691. setContentView(R.layout.activity_principal);
  692.  
  693. usuariotxt = (EditText) findViewById(R.id.usuariotxt);
  694. contrasenatxt = (EditText) findViewById(R.id.contrasenatxt);
  695. //login boton
  696. btnlogin = (Button) findViewById(R.id.btnlogin);
  697. btnlogin.setOnClickListener(this);
  698. //fin login boton
  699. listado=(ListView) findViewById(R.id.listView);
  700.  
  701. obtDatos();
  702. obtDatos1();
  703. obtDatos2();
  704. obtDatos3();
  705. obtDatos4();
  706. obtDatos5();
  707. obtDatos6();
  708. }
  709.  
  710.  
  711. @Override
  712. public void onClick(View v) {
  713.  
  714. switch (v.getId()) {
  715.  
  716.  
  717. case R.id.btnlogin:
  718.  
  719. if(usuariotxt.getText().length()==0||contrasenatxt.getText().length()==0){
  720. AlertDialog.Builder error = new AlertDialog.Builder(this);
  721. error.setMessage("Usurario o Contraseña Incorrectos")
  722. .setPositiveButton("Continuar", new DialogInterface.OnClickListener() {
  723. @Override
  724. public void onClick(DialogInterface dialog, int which) {
  725. dialog.dismiss();
  726. }
  727. })
  728. .setTitle("ENSERIO ERRORES?")
  729. .create();
  730. error.show();
  731. break;
  732.  
  733. }
  734. else
  735. {
  736.  
  737.  
  738. verificarcontraseña();
  739. int a=checkpass;
  740.  
  741. if(verificarinicio()&&(checkpass==1940)){
  742.  
  743.  
  744. Intent i = new Intent(Principal.this, perfil.class);
  745.  
  746. i.putExtra("usuario", usuario);
  747. i.putExtra("nombre", nombref);
  748. i.putExtra("lista1",listanombre);
  749. i.putExtra("lista2",listanit);
  750. i.putExtra("lista3",listapass);
  751. i.putExtra("lista4",listacliente);
  752. i.putExtra("lista5",listarmas);
  753. i.putExtra("lista6",listaradio);
  754. i.putExtra("lista7",listaguarda);
  755. startActivity(i);
  756. //finish();
  757.  
  758. break;
  759. }else if(checkpass!=1940)
  760. {
  761. AlertDialog.Builder error = new AlertDialog.Builder(this);
  762. error.setMessage("revisa lo que hiciste ¬¬")
  763. .setPositiveButton("Continuar", new DialogInterface.OnClickListener() {
  764. @Override
  765. public void onClick(DialogInterface dialog, int which) {
  766. dialog.dismiss();
  767. }
  768. })
  769. .setTitle("ENSERIO ERRORES?")
  770. .create();
  771. error.show();
  772. break;
  773. }
  774.  
  775. }
  776.  
  777.  
  778.  
  779.  
  780. //startActivity(new Intent(this, perfil.class));
  781.  
  782. // break;
  783.  
  784.  
  785. }
  786. }
  787.  
  788.  
  789. }
Add Comment
Please, Sign In to add comment