{"id":2092,"date":"2011-02-23T02:24:02","date_gmt":"2011-02-22T21:24:02","guid":{"rendered":"http:\/\/aasims.wordpress.com\/?p=2092"},"modified":"2025-05-16T08:41:07","modified_gmt":"2025-05-16T08:41:07","slug":"creating-a-webicon-blackberry-application-development-tutorial-part-4","status":"publish","type":"post","link":"https:\/\/aasimnaseem.com\/blog\/creating-a-webicon-blackberry-application-development-tutorial-part-4\/","title":{"rendered":"BlackBerry Application Development Tutorial (Part-4)"},"content":{"rendered":"<p>Hello All,<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"http:\/\/t3.gstatic.com\/images?q=tbn:ANd9GcTYnQdzHWLBcNJgaVR94aITKXRrJl7HHEy3ksbYyiJlbTiUdH5R\" alt=\"\" width=\"227\" height=\"222\" \/>Hope you&#8217;re enjoying the world around you.<\/p>\n<p>Surprised?? I know; after a long time, I am here writing a tutorial on BlackBerry application development. It is a requested tutorial, asked for by some developers a few days back. So here it is:<\/p>\n<p><!--more--><\/p>\n<p><strong>Note:<\/strong> This tutorial is a part of a series of my tutorials on BlackBerry application development; so far we have discussed the following.<\/p>\n<ul>\n<li><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2009\/09\/22\/blackberry-application-development-introduction\/\">Introduction :: BlackBerry Application Development<\/a><\/li>\n<li><a title=\"BlackBerry Application Development Tutorial\u00a0(Part-2)\" href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2009\/09\/23\/blackberry-application-development-tutorial-part-2\/\">Setting Up Your System :: BlackBerry Application Development Tutorial\u00a0(Part-2)<\/a><\/li>\n<li><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2009\/10\/17\/blackberry-application-development-tutorial-part-3\/\">Your First Application ::\u00a0BlackBerry Application Development Tutorial\u00a0(Part-3)<\/a><\/li>\n<li><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/23\/creating-a-webicon-blackberry-application-development-tutorial-part-4\/\">Creating A WebIcon ::\u00a0BlackBerry Application Development Tutorial\u00a0(Part-4)<\/a><\/li>\n<\/ul>\n<p><strong>Introduction:<\/strong><br \/>\n<em>My friend has a problem: He visits a site many times a day. Every time he has to open browser, type the site name or chose from favorites to see it. He asked, what if there is an icon on my home screen that directly open a browser and navigate to that particular site?&#8221; By doing this, i need just one tap, just one. <\/em><\/p>\n<p>The solution is <em>Web Icon. <\/em>How? \u00a0I&#8217;m telling you next. First bring a cup of coffee or tea, whatever you like; I brought a cup of Qehwa (a local drink for winters) with two chocolates. Bryan adams is playing in background. Sit relax.<\/p>\n<p>Here we go. A web icon is an application that launches a BlackBerry smartphone browser to a predefined web address. Web icons displayed in the list of BlackBerry smartphone applications and they can be used as shortcuts to a BlackBerry smartphone user&#8217;s favorite websites.<\/p>\n<p>Lets start. The first thing is to create a new class that extends from WebIcon. Here I&#8217;m dividing talk in two parts; Frist for the devices earlier to 4.0 and second, the part is for 4.1 and later.<\/p>\n<p><strong>1. BlackBerry Device Software earlier than 4.0<\/strong><\/p>\n<p>When using BlackBerry Device Software versions earlier than 4.0, the default browser is the only one that can be invoked;<\/p>\n<p><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2093\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/2.png\" alt=\"\" width=\"554\" height=\"589\" \/><\/a><\/p>\n<p>As an example, a new class called\u00a0<code>BlackBerryWebIcon<\/code> is created below that extends\u00a0<code>WebIcon<\/code> and points to <a href=\"http:\/\/www.AasimNaseem.com\">my blog, AasimNaseem.com;<\/a> only three lines of code need to be added to the <code>main<\/code> method of this new class.<\/p>\n<p><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/screen-shot-2011-02-23-at-1-21-32-am.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2094 aligncenter\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/screen-shot-2011-02-23-at-1-21-32-am.png\" alt=\"\" width=\"581\" height=\"155\" \/><\/a><\/p>\n<p><strong>2. BlackBerry Device Software 4.0 and later<\/strong><\/p>\n<p>The previous sample can also be used for BlackBerry Device Software up to and including 4.2.1, although the following code samples offer a simpler methodology for allowing the web icon to invoke the default browser or invoke specific browsers on the BlackBerry smartphone.<\/p>\n<p>A web icon may invoke either the default browser on the BlackBerry smartphone or the Internet Browser, the Wireless Application Protocol (WAP) Browser, the BlackBerry\u00ae Browser, the Wi-Fi\u00ae Browser, or the BlackBerry\u00ae Unite!\u2122 Browser.<\/p>\n<p>The following code creates a web icon that launches a browser to a specific web address for the given browser type; \u00a0If the given browser type is not available, the web icon launches the default browser.<\/p>\n<p><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2098\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/4.png\" alt=\"\" width=\"600\" height=\"499\" \/><\/a><\/p>\n<p><strong>Note: <\/strong>The previous code sample makes static calls to a factory class called\u00a0<code>BrowserSessionFactory<\/code> to create these different\u00a0 <code>BrowserSessions; <\/code>One thing more ist that BlackBerry Device Software 4.2 may prevent the previous code sample from opening the default browser. As a workaround, add the following code after the call to the <code>displayPage<\/code> method: This issue was resolved in BlackBerry Device Software 4.2.1;<\/p>\n<p><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/screen-shot-2011-02-23-at-1-37-08-am.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2099\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/screen-shot-2011-02-23-at-1-37-08-am.png\" alt=\"\" width=\"581\" height=\"102\" \/><\/a><\/p>\n<p>As an example, a new class called\u00a0<code>BlackBerryWebIcon<\/code> is created in the following sample that extends<code>WebIcon<\/code> and points to <a href=\"http:\/\/www.AasimNaseem.com\">my blog, AasimNaseem.com;<\/a>. Again, only three lines of code need to be added to this new class.<\/p>\n<p><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2100\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2011\/02\/5.png\" alt=\"\" width=\"576\" height=\"138\" \/><\/a><\/p>\n<p>At this point we are get done with code; Thumbs up; Plus its time to change Bryan Adams. Let try some slow number of Richard Marx.<\/p>\n<p>Alright, next is to set the title of your application, as this title will be appears on the Home screen of the smartphone \u00a0user scrolls over the icon; To to this, <strong>right-click the project<\/strong>, select\u00a0<strong>Properties<\/strong> and then select the\u00a0<strong>General<\/strong> tab. In this area, you can type the application title, vendor name and application description.<\/p>\n<p>Done; ?? great; Now next is to add an application icon. This is the icon that displays on the Home screen of the BlackBerry smartphone. Do the following steps:<\/p>\n<div>\n<ul>\n<li>Create an image approximately 32 x 32 pixels in size.<\/li>\n<li><strong>Right-click the project,<\/strong> select\u00a0<strong>Add File to Project<\/strong>, and then navigate to the <strong>custom icon<\/strong>.<\/li>\n<li>Once the file is added, <strong>right-click the file<\/strong>, and then select\u00a0<strong>Properties<\/strong>.<\/li>\n<li>Select the check box for\u00a0<strong>Use as Application Icon<\/strong>.<\/li>\n<\/ul>\n<\/div>\n<p>Congratulations. You have done it; isn&#8217;t that simple?? Indeed it is; Make victory sign; Compile and deploy on your phone;<\/p>\n<p>Feel free to throw queries incase you found a problem.<br \/>\nHave a nice time.<\/p>\n<p>Happy Development;<\/p>\n<p>source:\u00a0<a href=\"http:\/\/www.blackberry.com\/knowledgecenterpublic\/livelink.exe\/fetch\/2000\/348583\/800332\/800440\/How_To_-_Create_a_web_icon.html?nodeid=1487655&amp;vernum=0\" rel=\"nofollow\">http:\/\/www.blackberry.com\/knowledgecenterpublic\/livelink.exe\/fetch\/2000\/348583\/800332\/800440\/How_To_-_Create_a_web_icon.html?nodeid=1487655&amp;vernum=0<\/a><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/s08.flagcounter.com\/count\/NI5\/bg=FFFFFF\/txt=000000\/border=FFFFFF\/columns=6\/maxflags=200\/viewers=0\/labels=1\/pageviews=1\/\" alt=\"free counters\" border=\"0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello All, Hope you&#8217;re enjoying the world around you. Surprised?? I know; after a long time, I am here writing a tutorial on BlackBerry application development. It is a requested tutorial, asked for by some developers a few days back. So here it is:<\/p>\n","protected":false},"author":1,"featured_media":5202,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[207,208,214,216,217,291,298,581,1083],"class_list":["post-2092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blackberry","tag-blackberry-application-development","tag-blackberry-application-development-tutorial","tag-blackberry-jde-plug-in-for-eclipse","tag-blackberry-tutorial","tag-blackberry-with-eclipse","tag-configuring-eclipse-with-blackberry","tag-creating-a-webicon","tag-java","tag-web-icon-tutorial-in-blackberry"],"_links":{"self":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/2092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/comments?post=2092"}],"version-history":[{"count":5,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/2092\/revisions"}],"predecessor-version":[{"id":5405,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/2092\/revisions\/5405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media\/5202"}],"wp:attachment":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media?parent=2092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/categories?post=2092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/tags?post=2092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}