terça-feira, 18 de janeiro de 2011

creating your first widget...

In the last post we've learned some concepts about Widgets and how to configure our development environment.

At this time I'm intending to show you a Hello World widget...

Let's get started!

1. Open your Eclipse :)
2. File > New > Other (Or Widget Project, if it was presented for you), as shown in Fig 1.

Figure 1. Creating a new Project



3. Select "Widget Project" > Next... as shown in Figure 2.

Figure 2. Creating a new Widget Project



4. Give a name to your project, as shown in Figure 3.
5. Note that you must fill Width and Height sizes according to the target device. I've configured with 240 x 320 (Corby screen size) in this example. If you keep default value you can get in trouble to emulate your application (that will be only available in part of the screen).

Figure 3. Create Widget Project



6. Select a device to emulate your application, as shown in Figure 4.
Note that this choice is based on the configuration of your project (previous screen)

Figure 4. Select Device



7. Select Hello World Template, as shown in Figure 5 and "Next..."

Figure 5. Select a Template



8. Eclipse will ask you to change your perspective, as shown in Figure 6.
Note: A view is typically used to navigate a hierarchy of information, open an editor, or display properties for the active editor. A set of Views is a Perspective. Samsung has created a perspective for widgets development. :)

Figure 6. Open associated perspective



Ok, we got a widget project into the workspace, as shown in Figure7.

9. Rigth click on Project into workspace and "Package", as shown in Figure 7. This is need to generate .wgt package (that is used in emulation). Note that a .wgt file is created into "packages>Corby" folder.

Figure 7. Workspace



Ok, interesting!!! How can I execute this example?

9. Rigth click on Project into workspace and "Package", as shown in Figure 7. This is need to generate .wgt package (that is used in emulation). Note that a .wgt file is created into "packages>Corby" folder.

Figure 8. Packaging...



10. Rigth click on Project into workspace and "Run As... > Widget" as shown in Figure 9.

Figure 9. Running...



11. You'll be asked to choose a device to emulate your App. In this example, we are considering just Corby, as shown in Figure 10. You can add others devices anytime you want, dont worry! :)

Figure 10. Confirm the device to emulate your app...



12. Congratulations! You got your first widget emulation :)

Figure 11. Emulated Hello World App!



I suggest you to start reading:
Samsung Tools e SDKs

Samsung Mobile Widget SDK Guide

Available Widgets for Download (you can easy download, see and run all of the widgets)

Device Specs (find devices for the application that you want to develop - screen size, user interface, ...)


Thanks for your visit! :)

Next post: Better understanding our First Widget!

Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo

Nenhum comentário:

Postar um comentário