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 31 32
| public class MDPinterne extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mdpinterne);
Button button = (Button) findViewById((R.id.button3));
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText mdp = (EditText) findViewById(R.id.editText2);
String chmdp = mdp.getText().toString();
try {
// open myfilename.txt for writing
OutputStreamWriter out = new OutputStreamWriter(openFileOutput("mdpsecurity",0));
// write the contents on mySettings to the file
out.write(chmdp);
// close the file
out.close();
} catch (java.io.IOException e) {
//do something if an IOException occurs.
}
}
});
}
} |
Partager