-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDoctorHome.java
35 lines (29 loc) · 1.23 KB
/
DoctorHome.java
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
33
34
35
package com.example.loginpage;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class DoctorHome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doctor_home);
SharedPreferences sharedPreferences1 = getSharedPreferences("shared_prefs", Context.MODE_PRIVATE);
String username = sharedPreferences1.getString("username","").toString();
Toast.makeText(getApplicationContext(), "Welcome Doctor "+username, Toast.LENGTH_SHORT).show();
CardView exit = findViewById(R.id.cardExit);
exit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SharedPreferences.Editor editor = sharedPreferences1.edit();
editor.clear();
editor.apply();
startActivity(new Intent(DoctorHome.this,DoctorLogin.class));
}
});
}
}