JOHN JOHNNNY

JOHN JOHNNNY

  • NA
  • 190
  • 135k

Simple login In Android

Feb 14 2015 4:05 PM
Hi

I created a simple login in android, in which user will have to input unique pin before gaining access to the app but i need more features to be implemented in the code and they are as follows
1. how to make the user log in into the app once, if the user exit the app and wants to use the app it will not ask the user to log in again to use it unless the user uninstall the app
2. how to add progress bar on the log in page, when the user click the activate button it will display for five secs before navigating to the home page if the pin entered is correct
3. how to add more unique pins in the code, any user that hsi /her pin does not tally with the listed pin will not activate the app
See my code below

public class MyActivity extends ActionBarActivity {

private static TextView tV1;
private static EditText pin;
private static Button activate;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);

LoginButton();
}

public void LoginButton(){
tV1 = (TextView) findViewById(R.id.tV1);
pin = (EditText) findViewById(R.id.pin);
activate = (Button) findViewById(R.id.activate);

activate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (pin.getText().toString().equals("094523")){
Toast.makeText(MyActivity.this, "Pin is Correct",Toast.LENGTH_LONG).show();
Intent intent = new Intent("com.example.akinyemi.simplelogin.User");
startActivity(intent);
}else {
Toast.makeText(MyActivity.this, "Pin is Wrong...Kindly visit our website or vendor to BUY Pin",Toast.LENGTH_LONG).show();
}
}
});
}
Kindly help

Answers (1)