Advertisement
Guest User

Untitled

a guest
Jun 11th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. public class Choose_Action extends Activity{
  2.  
  3. Button button;
  4. EditText editText;
  5. TextView text;
  6. @Override
  7. protected void onCreate(Bundle savedInstanceState){
  8. super.onCreate(savedInstanceState);
  9. requestWindowFeature(Window.FEATURE_NO_TITLE);
  10. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  11. setContentView(R.layout.choose_action_layout);
  12.  
  13. button = (Button)findViewById(R.id.btn);
  14. editText = (EditText)findViewById(R.id.edit);
  15. text = (TextView)findViewById(R.id.textview);
  16.  
  17. }
  18.  
  19. public void Check(View v) {
  20. text.setText(editText.getText().toString());
  21. }
  22.  
  23. public class MainActivity extends Activity {
  24.  
  25. EditText pass;
  26. EditText user;
  27.  
  28. @Override
  29. protected void onCreate(Bundle savedInstanceState){
  30.  
  31. super.onCreate(savedInstanceState);
  32. requestWindowFeature(Window.FEATURE_NO_TITLE);
  33. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  34. setContentView(R.layout.main_layout);
  35.  
  36. pass = (EditText)findViewById(R.id.password);
  37. user = (EditText)findViewById(R.id.username);
  38.  
  39. }
  40.  
  41. public void LogIn(View v){
  42. AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
  43. LayoutInflater inflater = this.getLayoutInflater();
  44. final View dialogView = inflater.inflate(R.layout.dialog_layout, null);
  45. builder.setView(dialogView);
  46.  
  47.  
  48. builder.setPositiveButton("Войти", new DialogInterface.OnClickListener() {
  49. public void onClick(DialogInterface dialog, int arg1) {
  50. if(pass.getText().toString()=="pass" && user.getText().toString()=="user"){
  51. startActivity(new Intent(MainActivity.this, Choose_Action.class));}
  52.  
  53. startActivity(new Intent(MainActivity.this, Choose_Action.class));
  54.  
  55. }
  56. });
  57. builder.setNegativeButton("Отмена", new DialogInterface.OnClickListener() {
  58. public void onClick(DialogInterface dialog, int arg1) {
  59. //startActivity(new Intent(MainActivity.this, MainActivity.class));
  60. }
  61. });
  62. builder.show();
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement