Advertisement
rabzouz

Untitled

Apr 24th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1.  
  2. Package com.example.rabzouz.testapp;
  3.  
  4. Importer android.os.Bundle;
  5. Importez android.support.design.widget.FloatingActionButton;
  6. Importer android.support.design.widget.Snackbar;
  7. Importer android.support.v7.app.AppCompatActivity;
  8. Importer android.support.v7.widget.Toolbar;
  9. Importer android.view.View;
  10. Importer android.view.Menu;
  11. Importer android.view.MenuItem;
  12. Importer android.content.Intent;
  13. Importer android.widget.EditText;
  14. Importer android.widget.Toast;
  15.  
  16.  
  17. Classe publique MainActivity étend AppCompatActivity {
  18.  
  19.  
  20. DatabaseHelper helper = new DatabaseHelper (ceci);
  21. @Passer outre
  22. Protected void onCreate (Bundle savedInstanceState) {
  23. Super.onCreate (savedInstanceState);
  24. SetContentView (R.layout.activity_main);
  25.  
  26.  
  27. Barre d'outils de la barre d'outils = (Barre d'outils) findViewById (R.id.toolbar);
  28. SetSupportActionBar (barre d'outils);
  29.  
  30. FloatingActionButton fab = (FloatingActionButton) findViewById (R.id.fab);
  31. Fab.setOnClickListener (nouvelle View.OnClickListener () {
  32. @Passer outre
  33. Public void onClick (vue vue) {
  34. Snackbar.make (voir, "Remplacer par votre propre action", Snackbar.LENGTH_LONG)
  35. .setAction ("Action", null) .show ();
  36. }
  37. });
  38. }
  39.  
  40. @Passer outre
  41. Public boolean onCreateOptionsMenu (Menu menu) {
  42. // Infléchissez le menu; Cela ajoute des éléments à la barre d'action si elle est présente.
  43. GetMenuInflater (). Gonfler (R.menu.menu_main, menu);
  44. Retourne vrai;
  45. }
  46.  
  47. Public void onButtonClick (Vue v)
  48. {
  49. If (v.getId () == R.id.Blogin)
  50. {
  51.  
  52. EditText a = (EditText) findViewById (R.id.TFusername);
  53. String str = a.getText (). ToString ();
  54. EditText b = (EditText) findViewById (R.id.TFpassword);
  55. String pass = b.getText (). ToString ();
  56.  
  57. String password = helper.searchPass (str);
  58. Si (pass.equals (mot de passe))
  59. {
  60. Intention i = new Intent (MainActivity.this, Display.class);
  61. I.putExtra ("Nom d'utilisateur", str);
  62. StartActivity (i);
  63. }
  64.  
  65. autre
  66. {
  67. Toast temp = Toast.makeText (MainActivity.this, "Nom d'utilisateur du correspondant PAS !!", Toast.LENGTH_SHORT);
  68. Temp.show ();
  69.  
  70. }
  71.  
  72.  
  73. }
  74. If (v.getId () == R.id.Bsignup)
  75. {
  76. Intention i = new Intent (MainActivity.this, SignUp.class);
  77. StartActivity (i);
  78.  
  79.  
  80. }
  81. }
  82.  
  83. @Passer outre
  84. Public boolean onOptionsItemSelectionné (élément MenuItem) {
  85. // Activer l'élément de la barre d'action cliquez ici. La barre d'action
  86. // gère automatiquement les clics sur le bouton Accueil / Haut, si long
  87. // lorsque vous spécifiez une activité parent dans AndroidManifest.xml.
  88. Int id = item.getItemId ();
  89.  
  90. // noobspection SimplifiableIfStatement
  91. If (id == R.id.action_settings) {
  92. Retourne vrai;
  93. }
  94.  
  95. Retourner super.onOptionsItemSelectionné (article);
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement