Advertisement
Guest User

Untitled

a guest
Jan 13th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. package com.das.dasbabu;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.content.SharedPreferences;
  6. import android.os.Bundle;
  7. import android.view.Menu;
  8. import android.view.View;
  9. import android.view.View.OnClickListener;
  10. import android.widget.Button;
  11. import android.widget.EditText;
  12. import android.widget.TextView;
  13. import android.widget.Toast;
  14.  
  15. public class entry extends Activity{
  16.  
  17. TextView tpwd;
  18. Button btn_reg,chk;
  19. String user,password;
  20. EditText us,pw;
  21.  
  22. protected void onCreate(Bundle savedInstanceState) {
  23. super.onCreate(savedInstanceState);
  24. setContentView(R.layout.entry);
  25.  
  26. tpwd=(TextView)findViewById(R.id.textView5);
  27. btn_reg=(Button)findViewById(R.id.button1);
  28. chk=(Button)findViewById(R.id.button2);
  29. us=(EditText)findViewById(R.id.editText1);
  30. pw=(EditText)findViewById(R.id.editText2);
  31.  
  32. tpwd.setOnClickListener(new OnClickListener() {
  33.  
  34.  
  35. public void onClick(View arg0) {
  36. Intent int1=new Intent(getApplicationContext(),pass_set.class);
  37. startActivity(int1);
  38.  
  39.  
  40. }
  41. });
  42. btn_reg.setOnClickListener(new OnClickListener() {
  43.  
  44.  
  45. public void onClick(View arg0) {
  46. Intent int2=new Intent(getApplicationContext(),register.class);
  47. startActivity(int2);
  48.  
  49. }
  50. });
  51.  
  52. chk.setOnClickListener(new OnClickListener() {
  53.  
  54.  
  55. @Override
  56. public void onClick(View arg0) {
  57.  
  58. user=us.getText().toString();
  59. password=pw.getText().toString();
  60. SharedPreferences log=getSharedPreferences("regdet", MODE_WORLD_READABLE);
  61. String shruser=log.getString("username","not found");
  62. String shrpas=log.getString("Newpassword","not found");
  63.  
  64. if(user.equals(shruser)&&(password.equals(shrpas)))
  65. {
  66.  
  67.  
  68. Intent chk=new Intent(getApplicationContext(),dec_enc_option.class);
  69. startActivity(chk);
  70.  
  71. }
  72. else
  73. {
  74. Toast.makeText(getApplicationContext(), "Invalid username/password",Toast.LENGTH_LONG).show();
  75. }
  76.  
  77. }
  78. });
  79. }
  80.  
  81. @Override
  82. public boolean onCreateOptionsMenu(Menu menu) {
  83. // Inflate the menu; this adds items to the action bar if it is present.
  84. getMenuInflater().inflate(R.menu.main, menu);
  85. return true;
  86. }
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement