Code Example‎ > ‎

Image

Choose File >>New>>Project under eclipse menu.
Then from the New Project Dialog, Select Droidget Wizard>>Project
Fill necessary fields including project name..etc.. and Click Finish
Project with the given name will appear in the Eclipse project explorer.

Copying images

Create a folder called 'img' under src folder and copy images to img folder (these images will be used to animate 'waving' with javascript).

droid01.png         droid02.png

Finally your folder structure should look like following:


 
           
Create a Javascript file

function buttonHandler(){
   document.images["htmlImg"].src = "img/droid02.png";
} 

Edit index.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <title>ImageSample</title>
    <script type="text/javascript" src="js/script.js"></script>
</head>
<body>
    <img src="img/droid01.png" name="htmlImg" />
    <input type="button" id="formBtn" value="Click Here" onclick="buttonHandler()"/>
</body>
</html>

Deploy the Widget

Now save and deploy the project
  • From the eclipse menu select Droidget --> packaging
  • Then Droidget-->install packaging
Or 
  • upload the Widget to web server and update the download.html file as follows. Then access the download.html from the smart phone and install the widget from URI.

download.html

<html>
<head>
    <title>Download</title>
</head>
<body>
    <a href="droidget://www.example.com/ImageSample.wgt">ImageSample</a><br>
</body>
</html>

Preview




ċ
ImageSample.wgt
(10k)
ユーザー不明,
2010/09/03 2:05
Comments