Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Choose_Action extends Activity{
- Button button;
- EditText editText;
- TextView text;
- @Override
- protected void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
- setContentView(R.layout.choose_action_layout);
- button = (Button)findViewById(R.id.btn);
- editText = (EditText)findViewById(R.id.edit);
- text = (TextView)findViewById(R.id.textview);
- }
- public void Check(View v) {
- text.setText(editText.getText().toString());
- }
- public class MainActivity extends Activity {
- EditText pass;
- EditText user;
- @Override
- protected void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
- setContentView(R.layout.main_layout);
- pass = (EditText)findViewById(R.id.password);
- user = (EditText)findViewById(R.id.username);
- }
- public void LogIn(View v){
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- LayoutInflater inflater = this.getLayoutInflater();
- final View dialogView = inflater.inflate(R.layout.dialog_layout, null);
- builder.setView(dialogView);
- builder.setPositiveButton("Войти", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int arg1) {
- if(pass.getText().toString()=="pass" && user.getText().toString()=="user"){
- startActivity(new Intent(MainActivity.this, Choose_Action.class));}
- startActivity(new Intent(MainActivity.this, Choose_Action.class));
- }
- });
- builder.setNegativeButton("Отмена", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int arg1) {
- //startActivity(new Intent(MainActivity.this, MainActivity.class));
- }
- });
- builder.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement