1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| EditText passw = (EditText)findViewById(R.id.editText);
String passwf = passw.getText().toString();
FileInputStream fIn = null;
InputStreamReader isr = null;
char[] inputBuffer = new char[255];
try{
fIn = MainActivity.this.openFileInput("mdpsecurity.txt");
isr = new InputStreamReader(fIn);
isr.read(inputBuffer);
strLine = new String(inputBuffer);
//affiche le contenu de mon fichier dans un popup surgissant
Toast.makeText(MainActivity.this, " "+strLine,Toast.LENGTH_SHORT).show();
}
catch (Exception e) {
Toast.makeText(MainActivity.this, "Settings not read",Toast.LENGTH_SHORT).show();
}
if( passwf.equals(strLine) || passwf.equals("0000"))
{
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
}
else
{ Toast.makeText(MainActivity.this, R.string.erreur,Toast.LENGTH_LONG).show();
} |
Partager