0

in my application, there's a Main Page and a bunch of pages to add different data. (i.e student, groups, Exercises). I have a registration page and an option to "Remember me" which leads me to the main page and I send the "Admin" there using intent. is there a way to insert and if function to know from which activity redirected the App to this activity to insert it into the if() enter image description here

 admin = new Admin1();
 admin.name = item.Get("Name").ToString();
 admin.age = int.Parse(item.Get("Age").ToString());
 admin.sport = item.Get("Sport").ToString();
 admin.email = item.Get("EMail").ToString();
 admin.phoneNumber = item.Get("PhoneNum").ToString();
 admin.LogIn = (bool)item.Get("LogIn");
 Intent intent1 = new Intent(this, typeof(MainPageActivity));
 intent1.PutExtra("Admin", JsonConvert.SerializeObject(admin));
 StartActivity(intent1);

enter image description here

admin = new Admin1(int.Parse(AgeLoginET.Text), SportLoginET.Text, NameLoginET.Text, 
PhoneNumberLoginET.Text, MailLoginET.Text, keep);
HashMap map = new HashMap();
map.Put("Name", admin.name);
map.Put("EMail", admin.email);
map.Put("Age", AgeParsed);
map.Put("PhoneNum", admin.phoneNumber);
map.Put("Sport", admin.sport);
map.Put("Login", keep);
DocumentReference DocRef = database.Collection("Users").Document(admin.email);
DocRef.Set(map);
Intent intent = new Intent(this, typeof(MainPageActivity));
intent.PutExtra("Admin", JsonConvert.SerializeObject(admin));
StartActivity(intent);

enter image description here

//In the OnCreate()
admin1 = JsonConvert.DeserializeObject<Admin1>(Intent.GetStringExtra("Admin"));
Paulo Mendonça
  • 635
  • 12
  • 28
NaVi
  • 1
  • Maybe this can help https://stackoverflow.com/questions/13674421/how-to-get-a-list-of-the-activity-history-stack/28296607 – ashu Mar 05 '20 at 19:57
  • You could use putExtra attribute of the Intent to pass the name of the Activity. Please refer to the link below. https://stackoverflow.com/questions/8119526/android-get-previous-activity – Wendy Zang - MSFT Mar 06 '20 at 08:44

0 Answers0