Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arina_dorofeeva.myapplication;
- import android.content.Intent;
- import android.graphics.Color;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.CheckBox;
- import android.widget.EditText;
- import android.widget.TextView;
- public class project extends AppCompatActivity {
- private static final String login = "do_it";
- private static final String password = "please";
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_project);
- }
- public void onClick(View v) {
- CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox);
- TextView textView = ((TextView) findViewById(R.id.textView));
- if (checkBox.isChecked()) {
- String user = ((EditText) findViewById(R.id.editText)).getText().toString();
- String pasStr = ((EditText) findViewById(R.id.editText1)).getText().toString();
- EditText log = ((EditText) findViewById(R.id.editText));
- EditText pas = ((EditText) findViewById(R.id.editText1));
- if (!pasStr.equals(password)) {
- textView.setTextColor(Color.RED);
- textView.setText("wrong password");
- log.setText("");
- pas.setText("");
- }
- if ((checkBox.isChecked())&&(pasStr.equals(password))) {
- Intent hello = new Intent(project.this, hello.class);
- hello.putExtra("omg", user);
- startActivity(hello);
- }
- } else {
- textView.setTextColor(Color.BLUE);
- textView.setText("don't u agree? :c");
- }
- }
- }
- package arina_dorofeeva.myapplication;
- import android.graphics.Color;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.widget.TextView;
- public class hello extends AppCompatActivity {
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_hello);
- TextView textView = ((TextView) findViewById(R.id.textView2));
- { String user = getIntent().getStringExtra("omg");
- textView.setTextColor(Color.BLACK);
- textView.setText("hello, "+ user+ " :3");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement