How to test your app functions on pc?

0

Uh id here quiz question now here we have to get the java uh java image view corresponding to this id you have to call dot set alpha and passing point four so how do i get you know that image view here so if you are playing like following along or at least you can give it a try the reason why we did this hash map is because of this so uh look at this hash map called m id tile map we have linked all of our xml ids with our image view so instead of doing switch case long switch case statements here like uh switched.

So i’ll show you what i mean next switch uh file which is a long cut or a case r dot id dot iv zero so if that particular tile is zero then you have to do m i v zero dot set alpha and four uh because by default decimals are doubles so just like acid to float and then will be case dot id dot image u zero one m iv zero one alpha load point four now something to note via website Note here if you might have like argument pattern here basically this whole part is the same the dot set alpha for all of them they’re going to be same the only thing that changes is this and this like this java image view it depends on the xml id that was passed in time so what if there was a way you can just map that and that’s why we did that hash map so now in this one line of code mid tile map that has an interior image view.

Tilemap dot get now here you can pass in tile so it shifts through all that the huge key value pairs and it it checks it with each id no no like i’ll show you how so like uh this let’s say if we pass in r dot id dot ib underscore 21 no no no no no no no no yes when even match then it returns this into the array oh sorry here this way if you replace this image view now all you have to do is whatever is returned so scroll all the way down to our one method one or two three in our step four starter code here uh whether yeah here this whole portion will just return the the correct image here it’s called dot set alpha float so instead of writing you know multiple suitcases if there are nines with nine cases uh inside the switch case uh block in this one line of code.

You did that because you already did the mapping beforehand well that was what it is any questions always I think if you put a meter or how many times i said that um if i can get a dollar for every time I’ve done that i could uh probably pay myself pay my college fees because i know no one’s asking questions i don’t know how the folks are taking to well i’m trying to do my best and if there are any questions i’ll be happy to answer them if i don’t get then well sure uh so now in one so whenever something is one what we do is we shift.

Or we iterate through all the tiles we check if the tile is in part of our winning ids if it is not called for winning ies then we set its alpha to 0.4 i think one thing i should have done is at each step i should have run the app development because so far you haven’t even seen the app so well let us um because our 203 is done you know what we’ll do or not not this head over to our terminal let’s save the changes because whenever you want to shift branches you have to save your changes hit commit dash m my work was f4 it will changes and now it will go basically i hope at least you have done it because i totally sleep in my mind um because these studios were like pretty organized here.

So if at any point on our local branches we can head over to starting with step one check out uh checkout and it’ll give us to that stage right at that stage you can run the app on our emulator so here’s the completed app oops okay i’ll show you even there all right i don’t want to make alabama win in this sample thing well uh yeah uh yes at stage one we only did this layout uh we nine and when you click on it nothing happens because on tile click was nothing if you do that uh one other thing is if you notice in the preview pane and if you notice in our app how you have these llc things you don’t have it.

So that’s something that um i’m going to talk about but let me briefly introduce that is this thing of tools so each image view if you notice each image view has two src’s src stands for source so currently the source an android source is as blank transparent square but tools source is the lsu logo so basically what it says is.

That in our in the actual android app show a blank transparent square right because in an app you want to show constant square the thing is if you don’t have this tools line in our preview pane while developing the app this is this transparent square and our whole from here to here will be transparent so we don’t know how our app looks right we need some preview so you can do tools src instead of android src you can do llc logo so in our preview pane it will show whatever is there in our tools src in a preview pane but in the actual app it will actually do whatever is there in our android src that’s just something to note and now we are very very close.

So we just have last step five and we are very close now step six is very short we’ll be fine um so i hope at least still here at least a general part of it is clear let’s run step two start the code okay again check out ours let us restart the app let’s see in this step what do we have so step two yeah our app now shows these styles but if there’s a win like this nothing happens and it even accepts yeah so that’s the thing let’s check step three what we did in step three check it out and run the app again so that’s how version control is so helpful so it it um just like all the code to however it was in that step three.

Now let’s see what we did here so here yes here also it won’t check if someone has one alabama’s turn let’s do it here lc star albums yeah there’s only one lse ruben in this uh step four now here is where we have actually done the check when so once um let us verify if our logic is correct so what do i mean step four what do we do remember we coded this one where it cycles through all the image views and if an image view is not in the winning combination it says sets it to translucent we also did the check one check one method where it checks those you know those corresponding winning combinations right.

So now if our app is called correctly oh oh oh so there’s some mistake here so this should actually be trans i mean opaque so we did some mistakes let’s see what we did get tile yeah for each of the tiles winning ids are you passing the correct winning ideas here okay so this was winning in vertical one so zero one zero two zero the code seems fine it calls one with three zero two zero recycle through all of these the tile is not equal to correct cell to this set alpha so again so there’s some small bug and to save time what we can do is is um actually here in here also there’s some functionality to do.