Advertisement
arinado

hello

Nov 28th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.40 KB | None | 0 0
  1. package arina_dorofeeva.myapplication;
  2.  
  3. import android.content.Intent;
  4. import android.graphics.Color;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.CheckBox;
  10. import android.widget.EditText;
  11. import android.widget.TextView;
  12.  
  13. public class project extends AppCompatActivity {
  14.  
  15.     private static final String login = "do_it";
  16.     private static final String password = "please";
  17.     @Override
  18.     protected void onCreate(Bundle savedInstanceState) {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.activity_project);
  21.     }
  22.  
  23.     public void onClick(View v) {
  24.         CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox);
  25.         TextView textView = ((TextView) findViewById(R.id.textView));
  26.  
  27.  
  28.         if (checkBox.isChecked()) {
  29.             String user = ((EditText) findViewById(R.id.editText)).getText().toString();
  30.             String pasStr = ((EditText) findViewById(R.id.editText1)).getText().toString();
  31.             EditText log = ((EditText) findViewById(R.id.editText));
  32.             EditText pas = ((EditText) findViewById(R.id.editText1));
  33.             if (!pasStr.equals(password)) {
  34.                 textView.setTextColor(Color.RED);
  35.                 textView.setText("wrong password");
  36.                 log.setText("");
  37.                 pas.setText("");
  38.             }
  39.             if ((checkBox.isChecked())&&(pasStr.equals(password))) {
  40.                 Intent hello = new Intent(project.this, hello.class);
  41.                 hello.putExtra("omg", user);
  42.                 startActivity(hello);
  43.             }
  44.         } else {
  45.             textView.setTextColor(Color.BLUE);
  46.             textView.setText("don't u agree? :c");
  47.         }
  48.     }
  49. }
  50. package arina_dorofeeva.myapplication;
  51.  
  52. import android.graphics.Color;
  53. import android.support.v7.app.AppCompatActivity;
  54. import android.os.Bundle;
  55. import android.widget.TextView;
  56.  
  57. public class hello extends AppCompatActivity {
  58.  
  59.  
  60.  
  61.     protected void onCreate(Bundle savedInstanceState) {
  62.         super.onCreate(savedInstanceState);
  63.         setContentView(R.layout.activity_hello);
  64.         TextView textView = ((TextView) findViewById(R.id.textView2));
  65.  
  66.     {   String user = getIntent().getStringExtra("omg");
  67.         textView.setTextColor(Color.BLACK);
  68.         textView.setText("hello, "+ user+ " :3");
  69.     }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement