transcription, and let's that watch screen good Okay, let's start with.
Okay, good morning. So when we review we'll review the midterm so good morning.
There's some questions about midterm so 3 okay, all these are available.
So my my theory about this right now is we're kind of moving on to
Well, that kind of we moved on to Android. The swift Ui stuff is kind of different.
It will be on the final exam. and so part of the review will be incorporated.
You know, kind of integrating all these things. So this can be a little later.
But but I will get it to if some of you are concerned about like wanting to.
Drop the class or something, but he did reasonably well in the first 2 assignments.
You should be fine on the on the term. button but anyway. But yeah, and then
Okay, So that's slow so that's that's what's going off the midterm for icons.
So i'm good that's where I tell you a little about application icons these are so here's a nice you know.
Page. yeah. that's a lot out so originally in android icons Were of like 48 by 48, and then it turns out they wanted to allow for different size icons whether they'll be you
know 100 pixels and different, you know, shapes.
And they had all these things they wanted to support. So what they ended up coming up with is, you know, in, you know, in Android 8.
They came out this idea of these adaptive icons.
And so the thing is, you specify 2 layers and there's a top layer, and then a mask between them, in order to make you know, in order to make your icons they show you very nicely how you do it and that way.
They can do special effects between the 2 and things, and also these pieces can then be used to generate bitmaps at various resolutions for older applications, different older versions of android.
So if you look in your project if you look at a project that is automatically generated here.
If you look in the I see, Launcher, there is this Ic launcher to Xml.
Any Dpi v. 26. This is where it specifies the actual icon that is, in a resolution independent format.
And this, you notice, is combining 2 separate drawables. the launcher background of the launcher foreground, which are here.
That's. right, I hear the drawables you know I see Launcher background, and I see launch a foreground, and so, as part of the import process, so I think it's under you can go and so on.
And so import I new travel. resource. file. Yeah, I there's a there are online tutorials for how to do that, and I should point out Yeah, So sorry.
So it's doing this nice thing of using this thing so in multiple versions.
And so when you look at it in your project you'll notice that this So first you, you would just specify these 2 as part of the import process, and it you can generate those from Png Files or something But you would definitely you know
create the for granted background, and then it the import.
The importer will Then you know make this and then It also makes all these others different resolutions, you know, so i'll do a resolution and different shapes.
These are the square ones, and then it also decides to make round ones, you know.
So it's like So these are all things that different versions of android and different circumstances might want to use.
So. Yeah, So this you don't use dot I I icon files.
No, not die. Co. files you'd have to import that into here, where I was looking.
Here there was a implementing adaptive icons design an active icons.
Yeah, so like there's if you look up adaptive icons you get, you know, there's lots of resources for how to make these things.
I'm kind of tempted to show you guys but I don't really feel like look we could play with that later on. but it's like it's fiddly and not really central conceptually but but I do think it's important to realize
a big thing that you do lot of times. you want to specify images as resolution independent and the way you do that is using vector formats rather than pixel-based formats.
So you know, if You're. thinking of classic adobe tools you want something that's from illustrator as opposed to Photoshop.
And that's what these Now, of course these xml things are like this really weird custom. android specific thing.
Svg. is kind of the most common Svg.
Is the most common vector format kind of like open web vector format and it's actually based on xml 2.
So underneath the hood. So there are ways to convert that to this.
But oh, yeah, line, Art: yeah, line. art is another way of talking about it.
But underneath the hood it's these it's coffee.
If you look at the technology is normally referred to as vector.
Graphics. yeah, you know. vector graphics versus you know pixel-based graphics and it's a it's a technological thing.
The fact that we create graphics on screen using pixels is how we do things today.
But how hasn't as it always been before. in fact, early graphics were all vector based graphics.
Fine. let's the original star wars Oh, Yes, let's see if I can leave series. show this.
Okay, have you all I don't know If any of you saw like this old like this? Is this old version of he also?
Yes, has some really bad sports sweet to assess. but
But anyway, this can you see this video right? But notice the graphics here.
Yeah. Okay, So if you look at the graphics here notice how it's all lines the way it was done is that this was a crt and a cathode gray tube is actually has a little electron gun that scans back and forth
across the screen. And so the graphics here were done by controlling where that electron beam draws on the screen. and rather than just painting the screen and doing this, it would actually do different lines.
And so it's very nice for drawing outlines not so good for drawing solid graphics.
So this, in effect, is what you want to do if you want resolution, independence, so.
So it's important to know about these these sort of issues.
Of course, the display technology we use nowadays actually based on little lights that go on and often are.
You know the LCD panels, and so it makes sense that we use image formats that more I can to those.
But yeah, resolution. Okay, moving on. So I want to. Just so, because I had mentioned that last time.
I want at least give a little more depth in that but now i'm going to those now close all those off.
But it's very nice at at least auto-generate it.
But it is kind of kind of lame that you have. All those like this direct remains things here.
But what I wanted to talk here. Yeah, you yeah, you can definitely do a lot more, too. Yeah.
Oh, yes, you can and I don't want this let's let's go to here so what I want to do today is make a splash screen because that's going to talk about we'll talk about intense basing this on a
tutorial from last year. but what we want to do is take the ideas from here and incorporate it into drag Demo 3.
What we would do is add a splash screen to drag Demo 3, and that, and by doing this we should be able to understand how you could make a splash screen.
So first off we should make the splash screen so we can go here going to say a new layout resource file, and we'll call this, so we'll say the splash screen.
This. Now we have this here and we have a blank layout so i'm going to start with a code view, and let's i'm going to take the splash green from here.
And we'll fiddle with it let's come here, and I can just take this, and we can see this layout, and then we can fit with it. So it's going to split view and you can see that
we have A. So let's not call it intent episode we'll call this. Let's try Demo 3 and so tax alignment center start.
Okay, that's interesting. So I want to send so to start at startup parent and end to parents that's will center it there.
We've got our Comp. 16. Oh, one then we have our continue about you know things.
So we have a screen, and we have a you know so there's a text view here for the title.
We, we have a another text, a text view for you know in a class, and we have a button, and the button has a method here that says, Start Main is what's going to get run, and you know and the text says continue on it So we have to
have a function start main in order to make this happen and now notice this says context: flash screen that's red because it doesn't exist. yet.
So what we want now is a I with cotton file called Splash Green, Kt.
And we're. going to need a appropriate class there so we'll go here and we'll make one new class file and copper post.
So your splash screen, Dot Kt: We have copy notes and drag Demo 3 class splash screen.
Okay, Now, what do we put in this so what we're going to do?
Is, we're actually going to make this activity this is a separate activity, and the ideas were to set.
So this activity starts first before the main activity so they'll splash up show for a while, and then move on to the main app.
So we go on to so let's go look at our old code here and see.
So what this is the splash green dot kt and you Notice what it it says, ?
That. that. So now we've got splash screen here it's an app compativity that's all what we expect.
We've got some things on what's the happening I think I can put.
I think I should put app name here, but that in activity in
So I think that should allow things to work here. yep and we are good now.
It's defined. Okay. could you explain app compat activity here.
So what is this app compat activity? This is the this is the type of object that we're using to represent activities?
Now you might say, Why am I doing compat activity? The this is a This is a funny kind of so classic android.
Let's see. So the so this is a base class for you know activities that wish you some of the newer platforms on older android devices.
So that's the weird thing about it it's this it works on older versions of android.
But it brings newer features so it's part of the remember I told you that you have to really code.
Are you? you're in hearing that class for the android behaviors? Yeah.
So yeah, this is built in Yes no, no, no, This is not like available.
This is more like view or something. This is this is the type, you know, when I say we say some view, or something.
This is the that's. the type of a of a struct here This is the type of the class, and we're calling the constructor there for it up.
So I mean if these see So it inherits from the normal one like, why don't we just when we just say android app activity that would make sense.
But we're calling app compat activity it's be to allow us to. Google has implemented you'll see all of this all over the place.
I I thought I had talked about this but I don't think I really have.
We're coding, to and to android version I thought, this is an old Api version, where I forget when we create we'll see a new, You see, a new project.
So when we say like, here, we see new new project we see new empty activity, and we have this thing of selecting the minimum Sdk: We're right now.
I've been coding to api 21 android 5.
But notice i've been doing things remember we like the stuff for the icons is actually from android 8.
So it's like how am I coding for lollipop.
But i'm using features from newer sdks and that's because there's all these Yeah, if you So if I really said api android 21 and I said use legacy support android things then really would
be coding for lollipop, you know, and and just so you get an idea.
Android 5 came out in 2,014 8 years ago.
So pretty old in mobile device, you know history. So how do I?
And, in fact, if I said this, I would be coding directly for that.
But instead, what happens by default here is I use these other libraries.
So let's see if I do this and I make a well to this under.
Let's go into this. Oh, no right okay so now, we're going to say use legacy support libraries, and if i'm right, and I might not be. but let's see.
Oh, you might still die that I was wondering if you would try doing something with Oh, yeah, the V. 7.
So they still give you the proprietary stuff, I was thinking they might not but but notice It's saying Android support V.
7 app bundle that's that's not we're getting here.
So in effect, Android Google has figured out this way of adding in code to older versions of Android to make them mostly act like newer versions of Android not completely.
You know, if you're familiar with web technologies it's kind of like all Polyfills, so you can mostly focus on newer stuff.
And so this is just so. this app compativity is just this class they've introduced on top of activity to deal with this.
So, hey? this is what we would know. This is the same thing that we had for main activity here.
It's also of type app compact activity so these are both actually activities.
And this activity we again have to override on create because we've got to tell it what to do when you create the activity.
And and here, with this one we call the super class, we set the content view to be what the Xml file, the layout Xml file here.
But in this case we're using this splash screen and we're, you know, put a little log messages are created, and then we have this dark main thing.
So this the idea of the start main it's a function that's going to be called when we click on the button when we click on this button.
You Then we'll go to the main activity if you look here i'll start wrong.
Screen. It generates a log message, and then it does this tent.
Things. So what this is it's creating an intent and the intent says, You know this, you know main activity class javascript.
So what We're literally saying is exploreitly whole this class, this activity class go run it, but it's it's an effect as a message.
You send the message more. it's actually what's happening is we, we send ghost go start that activity, because you'd say each activity kind of it's not running continuously and more sets up events to respond to things
so the main activities waiting for certain events this one's here this one's, you know, whether you call when someone was created, someone calls it and calls on create.
Here. we're essentially doing the same thing but we're invoking it.
But how does this intent actually work? How does this invoke?
It turns out, in order for this to work you have to add information about this into the application manifest.
So we're telling it to run here but in order for main activity to respond to this intent.
We have to authorize it. So this involves changing the manifest.
So remember this whole main activity you know things right now it's Set the mayor to be set to run when the launcher sends it something, and if anyone else sends it's like
You know, so we have to change this now the way let's go over here.
Let's look at its manifest so notice the difference here where I'm just going to let's just copy the intent filter part.
Well the activity part Sorry. So this is the part right here that that defines the activity.
And so this is the original, and here is what they did.
You know what we did, you know, to add them things so before we define the name of the activity we set it's exported.
And then we say, Here is the intent filter of what things will respond to.
Now, what we do here is, we do essentially the same thing as we did for main activity.
But just do it for splash screen so the splash screen class is what's going to You know, is the name of the activity, and it's the one that's going to get the launcher event 200 and then we just
define main activity as just a bare activity, no intent filter.
So what that means is is this: Since this is defined as an activity, it will get.
It can be explicitly called by name but it won't respond to more generic intense.
So here. this the launcher doesn't know what class should be run when launching this, you know, app there is no default.
This is the entry point for the app. It can, whatever you want.
You tell Android what the entry point is by defining the define the attentive will respond to so say, and it's like I'm gonna send you it you know.
Start your main activity and that's what you know this is you know the launch is going to send you . this intent.
And here we're saying, when you get by this intent filter, we're basically saying this is what you run when you get this stuff.
But I just yeah there. Yes, I don't want to stop text around there.
That would be bad. So we're defining this this filter here is just a way of saying I can respond to this generic android intent action main, which, when you do that call this code here with this activity we're
just defying it's an activity if you're gonna run it. You're gonna have to run it by name not with this android tensile action-made stuff.
You gotta know your calling main activity. but it's exported so anyone can do this.
What we have here in the splash screen is we are sending this message.
So we're saying, we don't know what accurate It is this package, you know, because it's in the same package, because you could divide up your app into separate packages separate namespaces as I said and so in
this package. run this class. You might go like main activity.
Colon colon class dot Java aren't we programming cotton cotton under the hood tries to act like Java.
It really is Java with nicer syntax.
Semantically. It is, you know, and a few little things to mentally basically job up.
So in order. for and in fact, we're interoperate so it's pretending to be java for everything else.
And so that's why you have silly things like this So I think with this I fixed it so that this will run.
Let's Okay, why can't I do a build Okay, see what errors we get?
Runs my poor fan while this is launching any questions on what's going on here?
Oh, right. I have a bug I forgot this I actually think this isn't necessary here.
I think it has to be exported I think it should be fine if it's just internal.
I think that was let's see if this works okay, I got one warning.
Yes, I know these never used us There and why can't I build it.
Really this is really weird, Are you not lying to do this Okay, I'm going to try quitting android studio and for your walk.
Let's see if it so you'd have separate intent files.
So you need to have separate activity declarations for for every activity and any it's so let's start this up, and i'll explain that.
Okay, now again. Now, that's there why that didn't show up before. I don't know but it didn't and let's see now if it builds I wonder if this is a little slope.
Because i'm using external ssd as opposed to the built-in one that's really shouldn't faster on this machine.
But we'll let this boot okay good so drag demo 3.
We're here, and we click continue and here we are and success and here, let's do this.
Yes, i'll notice that we'll start again. Okay, yeah there we go so like leads all that. So here again we do this.
It's here i'm curious if I go here and I don't hear about this, and if we rotate it should just keep running the same activity.
Where is that coming from? i'm just wondering what his background sound is
So, can we place multiple activities in the same screen?
Has sound effects. i'm not okay, but so can you place multiple activities.
So you can make us make up activity fragments and fragments can take can be used for part of the screen.
We're not going to cover activity fragments in this class. That is probably something.
I'll cover in 2,601 but but yes, you can split it up and abstract it.
So you have reusable portions. but the activity is the screen.
Does anyone follow this so far? It was just. you know any questions about this, because if if there are, then I want to.
So so now. So what we're really doing is here we made our app receive an implicit intent.
So this is saying that someone is the Launcher told us to to run and sent us this this action Maine, so we can if we go here.
Oh, I don't want that so you go here actions no! who was that nice?
However, there it is. okay. will just use. I am. There is action rates.
So this is all documenting the intense that you can happen.
You can use. These are all the and that's actually an operation we formed it.
We use star activity to launch an activity broadcasts that to industry broadcast for your components, facility for performing light, runtime binding between the code at different applications, losing uses the launching activities Google was
reacted also. This is good to have you want to see.
Are we explicit you're specifying an intent filter. There's just there's to iso intent.
Okay, start actually. So No. So here. So if you look here, it says, know explicit, intent specify, which application will satisfy the intent by supplying the targets app package name, or if fully qualified component class names
you're saying, run this particular app and implicit intent is saying, I want to do more generic operation, and here it's things like I want to open a web page.
So that's why you have to specify intent filters is basically saying what implicit intense am I willing to accept, Or I think you might be able to filter explicit intense But normally, those are like Ok, no
I'm being called. If you've exported yourself, then anyone on the system can call this and you know, since this intent is not, since we specified, this intent is not being the main activities not exported only within
this app Can we call this active, this activity? But splash screen can be called from anywhere on the device.
So now I want to make this program call a call something. So what we're gonna do is when we drag this circle here, and when we once we get success, we're actually going to load.
A web page, and that will fire up in the browser.
Here once. this success condition happens. so let's so we want to change that is, we want to go to main activity here, and where we want to change.
It is in here. the it shouldn't take that long actually the main thing is booting it.
But let's see what we've so actually move okay, so success.
So success here. This is where we're going to put the code, and we're going to hear call up the web browser in the way we do this.
I'm just going to copy the relevant code here where's that open page.
So here we're just assigning an intent to so now I notice it's saying red because we have imported the right thing.
So we right click on it. show context actions worked then it's fine.
So now that's been added, you know that's now here intent is now on the includes.
And then Oh, you're right parse that's also red show contact actions import.
And now it's important that we have now at the top android net.
Your I So all we've got is is 2 lines so here we're creating an intent again, and we're you know the act, you know action view, so that that's the action that's associated with learning a url we create
a Url out of parsing this things with. this is how it wants to represent web pages.
And then we start the activity using that explicitly so let's see if that works come on.
So we could continue. Are you here? success? Yes, I accept and continue.
No, thanks. Okay, it's trying to load it it's in a web browser.
It comes. is that taken a while to have network access wow I think You're right.
This is kind of slow. let's see if anyone pops up at some point.
Anyway. you can see it clearly launched the web browser but it's not see.
Look at It's kind of locked up here while it does something I've never had a fast experience with pandemic.
Yeah, yeah, it's it really wants as fast and machine as you can throw at it.
But so again, notice so intents aren't really that complex quick enough for a matter of my work.
Convenient, but Salonia. So this is the simulator.
Honestly, I find development for android works much better when you don't use the the the simulator i the weekend.
I was at a cottage, and I was. I was working on the code for this week, and I was using an old laptop.
You know this is an old laptop. It has, you know, only 8 gigs of memory, not particularly fast processor.
I found Android studio itself was perfectly fine, and I use. I have this old Nokia 6.1, and I am is running android 10.
I think, and you know I just plugged in a USB. cable.
I could run it from here, and it works fine. You know it.
It. Things were fine. I could see the log cat. you know all the development.
Really this is all this is doing. is emulating one of these I don't want to use it in class, because then I kind of go like, Oh, you see, this has done this and then the cable's too.
Short and stuff, and it's not there but if you're doing your own development.
I mean for the if you're just doing this class whatever. But if you're going to continue doing android development, having an android device around, even an old one because again, all the compatibility stuff does it but just having some old
android device, very helpful, very helpful to the similar crash.
It's not responding to button process Okay, let's stop you.
It would make a pop-up. Oh, yeah, if it crashes it.
Yeah, let's try rotating it not showing me anything fine i'm just going to so like that's not why I want to do let's move you back.
Down. Okay, So what to do with the class. So I think what you should be able to do.
Just hit X. and then let's try doing this again we also have one record.
I'm, Miss cook, I think we'll just we'll let it is it? they know.
Okay, let's go to device manager so like you're This is we're showing.
Fine vice is paying off things. Please accept debugging session on the device.
Okay, let let's go to that's good the device manager run!
Oh, where is the device manager device manager okay, let's go here.
Cold boot. Now, 2 I think I might just let's see?
No, Yeah, i'm gonna start that thing But I think i'm done for what i'll do this I can wrap up lecture now, and I can try showing you guys trick is i'm gonna have to like move my
web camera in weird ways to show it, because my cable isn't very long.
But I will see what I can do but that's all I wanted to show for today was how to how to get this sort of intent filters and stuff like that. next week we're gonna play with images in
android but i'll stop here and i'll be around for doing check-offs and for answering questions.