Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View v) {
- if (v.getId()==R.id.loadDataId){
- SharedPreferences sharedPreferences = getSharedPreferences("Mydata",MODE_PRIVATE);
- String name = sharedPreferences.getString("uname",DEFAULTVALUE);
- String pass = sharedPreferences.getString("pass",DEFAULTVALUE);
- if (name.equals(DEFAULTVALUE)|| pass.equals(DEFAULTVALUE)){
- Toast.makeText(this, "No Data was found", Toast.LENGTH_SHORT).show();
- }else {
- unamrTextView.setText(name);
- passTextView.setText(pass);
- Toast.makeText(this, "Data retrive successfully", Toast.LENGTH_SHORT).show();
- }
- }else if (v.getId()==R.id.backId){
- Intent intent = new Intent(this,MainActivity.class);
- startActivity(intent);
- Toast.makeText(this, "Go to Main Activity", Toast.LENGTH_SHORT).show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement