1 00:00:00,000 --> 00:00:04,700 so when it comes to actually, testing your application during development 2 00:00:04,700 --> 00:00:09,700 one of the things you're definitely gonna wanna have is a virtual device or an emulator. 3 00:00:09,700 --> 00:00:18,000 and this allows you to actually test your application here in the desktop environment instead of actually having to go out to a real device. 4 00:00:18,000 --> 00:00:23,000 now it's important to know that, nothing can really replace testing your application on a real device, 5 00:00:23,000 --> 00:00:31,300 because the emulator is actually pretty slow, you know so if you have things like animation and you really wanna get a feel for how your application behaves, 6 00:00:31,300 --> 00:00:38,500 the emulator can do a pretty good job but nothing will replace actually going out to a real device. but that can take time. 7 00:00:38,500 --> 00:00:45,000 so you defiantly gonna wanna have an emulator here.so from the SDK manager, we will click to virtual device, 8 00:00:45,000 --> 00:00:51,000 and now we're gonna create a new virtual device, i'm gonna click new, and we wanna give this a name, 9 00:00:51,000 --> 00:00:56,000 so now since we're targeting gingerbread here. i'm gonna call it Gingerbread, 10 00:00:56,000 --> 00:01:06,000 and now we wanna create this virtual device at a specific resolution, we're gonna set it at WVGA resolution. which is 800 by 480. 11 00:01:06,000 --> 00:01:13,000 so we're gonna put that in here just so that we know what size this actual emulator runs at. 12 00:01:13,000 --> 00:01:18,000 so now under target we're gonna choose the API level that we wanna target on this emulator. 13 00:01:18,000 --> 00:01:22,000 now again i've only installed Gingerbread so obviously i'm gonna choose that. 14 00:01:22,000 --> 00:01:30,000 now for SDK card and again the emulator is able to emulate most features of a phone including the SD card. 15 00:01:30,000 --> 00:01:40,000 so now it's asking us for a size for how big we want that SD card to be. i'm just gonna put in 10000 here, which is gonna be a 10 GB card. 16 00:01:40,000 --> 00:01:47,000 so the next feature here is snapshot, and this is really important. so with snapshot enabled 17 00:01:47,000 --> 00:01:55,000 we can, actually when we stop our virtual device from running, when we re-lunch it again we can re-lunch from a snapshot. 18 00:01:55,000 --> 00:02:02,500 which is incredibly faster than having to have it boot up from the beginning. so we definitely want to enable that here. 19 00:02:02,500 --> 00:02:10,000 now as far as a skin, basically it's asking us for the resolution. we could see we have a bunch of different options to choose from. 20 00:02:10,000 --> 00:02:19,000 now when it comes to testing your application on multiple resolutions and screen sizes, you gonna wanna come in here and 21 00:02:19,000 --> 00:02:26,000 create emulators for a bunch of different sizes so you can test against those, but for now we gonna leave it at the default here. 22 00:02:26,000 --> 00:02:35,000 and now we have some additional properties that we can set, so just the density, ram size, we're gonna leave the rest of things here at the default 23 00:02:35,000 --> 00:02:42,000 and actually this is telling us we have some invalid characters, so we actually need to put in an underscore here, we can't have space. 24 00:02:42,000 --> 00:02:48,000 ok so with that done, i'm gonna click create AVD and it's gonna go ahead and create that virtual device. 25 00:02:48,000 --> 00:02:55,000 now depending on your system, this could take a little while so we'll just wait for it to go ahead and create that emulator. 26 00:02:56,000 --> 00:03:04,000 ok so when it's finished creating the virtual device, you should get this massage, which basically just means everything's ok. so i'm gonna click ok. 27 00:03:04,000 --> 00:03:11,000 and now we can see it's listed here in our virtual devices's panel, so now the first thing we wanna do is to make sure everything running fine. 28 00:03:11,000 --> 00:03:15,000 we're gonna go ahead and start it. so i'm just gonna select it and then choose start. 29 00:03:15,000 --> 00:03:22,000 ok so now it's presenting us with some options about how we want to run the emulator, so one of the things we can do, 30 00:03:22,000 --> 00:03:27,800 if the resolution of the emulator is ganna be too big for your desktop, which it is for mine, 31 00:03:27,800 --> 00:03:38,000 800 height is actually gonna be too big for me to actually show here, we can scale it down by any amount that we want, so i'm gonna put in a screen size in inches of 7. 32 00:03:38,000 --> 00:03:47,000 and it actually gonna scale it down to about 72 percent of it's real size. and this is just so that we can work with it easier. 33 00:03:47,000 --> 00:03:55,500 and the next option is "wipe user data". so let's say we've used this particular emulator a bunch of times we have a bunch of apps installed, 34 00:03:55,500 --> 00:04:03,600 and then we've messed with the settings, if we choose "wipe user data", it's basically gonna set it back to a factory reset, and if we want to do that! 35 00:04:03,600 --> 00:04:14,500 now these next two, "lunch from snapshot" and "save to snapshot", again we wanna leave those checked so that in time that we wanna lunch it, it's actually gonna be much faster to start-up. 36 00:04:14,500 --> 00:04:19,500 so when we click lunch here, and now we can see the emulator starting-up. 37 00:04:19,500 --> 00:04:27,000 now remember that we didn't have a previous snapshot to lunch from, we're gonna have to wait here to android to actually boot-up. 38 00:04:27,800 --> 00:04:34,000 ok so now everything has booted-up and if you've used an android phone before, this is gonna look really familiar to you. 39 00:04:34,000 --> 00:04:40,000 and we have our desktop here or our home-screen, and our widget, i can click here on the app-luncher, 40 00:04:40,000 --> 00:04:47,500 we can look on all the different applications. of course we'll be putting a lot of applications in here over this coarse, 41 00:04:47,500 --> 00:04:53,600 but this works for the most part exactly like an android phone lookslike. it's pretty much like a full emulator here. 42 00:04:53,600 --> 00:05:00,000 so what i'm gonna do now is that i'm gonna close this. and we'll wait for this to close. 43 00:05:00,000 --> 00:05:09,000 now remember what it's doing here is actually saving a snapshot as well. so when we close this it saving out the snapshot, so next time when we start it, it's gonna be faster. 44 00:05:09,000 --> 00:05:15,500 so now let's start it again. we'll click start and we wanna make sure "lunch from snapshot" is still selected. 45 00:05:15,500 --> 00:05:21,000 we'll click lunch and you could see how incredibly faster that is! 46 00:05:21,000 --> 00:05:27,000 we don't have to wait for android to start-up and go through all those initialization stuff,boom out right into the emulator. 47 00:05:27,000 --> 00:05:35,000 so that's the basics of creating a virtual device, now remember you gonna wanna come through and create 48 00:05:35,000 --> 00:05:45,000 you know, whole slue of them, they represent deferent resolution, screen sizes and also different SDK versions, when you doing real world android development. 49 00:05:45,000 --> 00:05:46,000 AndroidApp.blog.ir