Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Package com.example.rabzouz.testapp;
- Importer android.os.Bundle;
- Importez android.support.design.widget.FloatingActionButton;
- Importer android.support.design.widget.Snackbar;
- Importer android.support.v7.app.AppCompatActivity;
- Importer android.support.v7.widget.Toolbar;
- Importer android.view.View;
- Importer android.view.Menu;
- Importer android.view.MenuItem;
- Importer android.content.Intent;
- Importer android.widget.EditText;
- Importer android.widget.Toast;
- Classe publique MainActivity étend AppCompatActivity {
- DatabaseHelper helper = new DatabaseHelper (ceci);
- @Passer outre
- Protected void onCreate (Bundle savedInstanceState) {
- Super.onCreate (savedInstanceState);
- SetContentView (R.layout.activity_main);
- Barre d'outils de la barre d'outils = (Barre d'outils) findViewById (R.id.toolbar);
- SetSupportActionBar (barre d'outils);
- FloatingActionButton fab = (FloatingActionButton) findViewById (R.id.fab);
- Fab.setOnClickListener (nouvelle View.OnClickListener () {
- @Passer outre
- Public void onClick (vue vue) {
- Snackbar.make (voir, "Remplacer par votre propre action", Snackbar.LENGTH_LONG)
- .setAction ("Action", null) .show ();
- }
- });
- }
- @Passer outre
- Public boolean onCreateOptionsMenu (Menu menu) {
- // Infléchissez le menu; Cela ajoute des éléments à la barre d'action si elle est présente.
- GetMenuInflater (). Gonfler (R.menu.menu_main, menu);
- Retourne vrai;
- }
- Public void onButtonClick (Vue v)
- {
- If (v.getId () == R.id.Blogin)
- {
- EditText a = (EditText) findViewById (R.id.TFusername);
- String str = a.getText (). ToString ();
- EditText b = (EditText) findViewById (R.id.TFpassword);
- String pass = b.getText (). ToString ();
- String password = helper.searchPass (str);
- Si (pass.equals (mot de passe))
- {
- Intention i = new Intent (MainActivity.this, Display.class);
- I.putExtra ("Nom d'utilisateur", str);
- StartActivity (i);
- }
- autre
- {
- Toast temp = Toast.makeText (MainActivity.this, "Nom d'utilisateur du correspondant PAS !!", Toast.LENGTH_SHORT);
- Temp.show ();
- }
- }
- If (v.getId () == R.id.Bsignup)
- {
- Intention i = new Intent (MainActivity.this, SignUp.class);
- StartActivity (i);
- }
- }
- @Passer outre
- Public boolean onOptionsItemSelectionné (élément MenuItem) {
- // Activer l'élément de la barre d'action cliquez ici. La barre d'action
- // gère automatiquement les clics sur le bouton Accueil / Haut, si long
- // lorsque vous spécifiez une activité parent dans AndroidManifest.xml.
- Int id = item.getItemId ();
- // noobspection SimplifiableIfStatement
- If (id == R.id.action_settings) {
- Retourne vrai;
- }
- Retourner super.onOptionsItemSelectionné (article);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement