1
00:00:00,400 --> 00:00:01,210
Welcome back.

2
00:00:01,480 --> 00:00:06,520
One thing that you might have noticed is the fact that even though we made changes to my profile and

3
00:00:06,520 --> 00:00:10,390
now it's not Homer about Homer Simpson and also the image is a different one.

4
00:00:11,050 --> 00:00:13,330
There are no changes on this screen here.

5
00:00:13,480 --> 00:00:13,900
All right.

6
00:00:13,900 --> 00:00:19,330
So if we go to my profile, we can see that it's a different detail that we see here.

7
00:00:19,340 --> 00:00:27,340
So Homer Simpson, instead of just Homer, if we update, we go back to the project manager screen here

8
00:00:27,340 --> 00:00:28,440
and no changes.

9
00:00:28,780 --> 00:00:34,510
So that is something that we will change now because we will start this activity as a real activity

10
00:00:35,020 --> 00:00:36,490
for result activity.

11
00:00:37,330 --> 00:00:37,830
All right.

12
00:00:37,840 --> 00:00:43,290
So basically, you want to get a response and then based on that, we want to do things.

13
00:00:43,780 --> 00:00:46,560
So let's go ahead and just implement the functionality for that.

14
00:00:46,570 --> 00:00:52,420
So, first of all, I'm going to create a companion object in my main activity so that I can create

15
00:00:52,420 --> 00:00:54,160
some constants in there.

16
00:00:54,190 --> 00:00:59,940
So let's go over to the activities here and then the main activity.

17
00:01:00,340 --> 00:01:11,480
So here, companion object, which will simply contain information about our profile request code.

18
00:01:11,500 --> 00:01:23,500
So while my profile request code and I'm going to assign 11 to it, so let's define it as an integer,

19
00:01:23,500 --> 00:01:27,010
just to be sure, even though it shouldn't be necessary.

20
00:01:27,010 --> 00:01:31,510
But still now it's an integer and we can go ahead and use it.

21
00:01:31,900 --> 00:01:38,890
So the next step we will need to do is to start the activity for result once we click on the navigation

22
00:01:39,460 --> 00:01:40,010
item.

23
00:01:40,030 --> 00:01:47,500
So here in our own navigation item selected, we have this nav my profile and we start the activity,

24
00:01:47,710 --> 00:01:49,950
but not for a specific result.

25
00:01:50,290 --> 00:01:52,420
So that is what we want to change now.

26
00:01:52,690 --> 00:01:56,710
So we're just going to add the four result year for result.

27
00:01:57,100 --> 00:02:03,820
And if we do that, we also need to enter the request code that we want to pass.

28
00:02:03,970 --> 00:02:06,550
OK, so let's at.

29
00:02:07,840 --> 00:02:13,480
Hey, come on here and at my profile request code.

30
00:02:15,050 --> 00:02:17,690
OK, so overall, this intent is going to look like this.

31
00:02:20,090 --> 00:02:25,450
You can see he has not activity for assault with the intent and then with my profile request code,

32
00:02:26,330 --> 00:02:32,930
then the third step is to send the result from my profile activity, because at one point we need to

33
00:02:32,930 --> 00:02:33,740
send the result.

34
00:02:33,740 --> 00:02:34,030
Right.

35
00:02:34,280 --> 00:02:39,590
And I'd say we should set the result once we click on the update.

36
00:02:39,590 --> 00:02:41,150
Profile success.

37
00:02:41,150 --> 00:02:44,770
So profile update, success function, progress bar.

38
00:02:44,780 --> 00:02:50,390
And here at this point, let's set the result as being activity

39
00:02:53,000 --> 00:02:53,720
result.

40
00:02:53,900 --> 00:02:54,440
OK.

41
00:02:55,900 --> 00:03:03,280
OK, so once we update it and we click on this button, the result will be OK and we can hear and this

42
00:03:03,280 --> 00:03:07,350
function now have an on activity result override.

43
00:03:07,590 --> 00:03:10,050
So our activity result.

44
00:03:11,320 --> 00:03:14,710
And here we can check if the result code was resolved.

45
00:03:14,740 --> 00:03:23,890
OK, so if result code is equal to activity, dot result.

46
00:03:24,790 --> 00:03:32,920
OK, and the request code was in fact the one that we prepared, which is my profile request code.

47
00:03:33,700 --> 00:03:41,680
So if that is given so those things are given, what we need to do is we need to load the user data

48
00:03:42,040 --> 00:03:43,090
and this activity.

49
00:03:43,090 --> 00:03:50,110
So via store class that loads user data.

50
00:03:51,530 --> 00:03:57,740
And she would need to pass him the activity, so we just passing the main activity and if it was something

51
00:03:57,740 --> 00:04:01,160
else, so if we got an error, we can just log on her right here.

52
00:04:01,250 --> 00:04:07,350
Logi canceled and the message could be also canceled.

53
00:04:10,140 --> 00:04:15,530
Going to be, of course, more descriptive here on activity result or something at that canceled.

54
00:04:15,530 --> 00:04:19,040
So whatever you want to add here to be more descriptive.

55
00:04:19,370 --> 00:04:25,460
But at this point, we should be able to test this and see if it's going to give us the required result.

56
00:04:28,910 --> 00:04:30,500
All right, so Peruggia Menasche.

57
00:04:31,710 --> 00:04:37,380
Now, let's look at it, we can see now it's going to be Homer Simpson, of course it will be, because.

58
00:04:38,320 --> 00:04:45,580
Now loaded the whole page and again, of course, it loaded the user data because that is what is done

59
00:04:45,580 --> 00:04:46,820
when the page is loaded, right.

60
00:04:47,080 --> 00:04:49,210
But now let's make changes in my profile.

61
00:04:50,270 --> 00:04:52,280
Let's now call this guy Homer.

62
00:04:52,310 --> 00:04:54,870
Again, it's Homer Simpson, it's Homer again.

63
00:04:55,270 --> 00:04:56,090
Let's update.

64
00:04:57,990 --> 00:05:00,660
And let's have a look and see now again.

65
00:05:01,410 --> 00:05:03,120
All right, so that seemed to work.

66
00:05:03,150 --> 00:05:09,000
Now you can see how you can make these changes without having to load the whole database once again

67
00:05:09,000 --> 00:05:13,250
when you come back without having this clean approach that we use.

68
00:05:13,300 --> 00:05:18,640
So now we start the activity because this profile page is really just a pop up, so to speak.

69
00:05:18,670 --> 00:05:22,770
OK, so we are opening it and once we go back, we want to.

70
00:05:23,770 --> 00:05:30,310
Make changes, if we press the button, however, then canceled will be executed, so let's have a look

71
00:05:30,310 --> 00:05:31,180
consult.

72
00:05:31,480 --> 00:05:32,980
We can see we get this error here.

73
00:05:33,400 --> 00:05:34,420
It says cancelled.

74
00:05:35,760 --> 00:05:39,380
All right, so let's go ahead to the next video, see you there.

