<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; java</title>
	<atom:link href="http://devblog.blackberry.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 18:00:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; java</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 11: Push</title>
		<link>http://devblog.blackberry.com/2013/05/cascades-porting-series-push-2/</link>
		<comments>http://devblog.blackberry.com/2013/05/cascades-porting-series-push-2/#comments</comments>
		<pubDate>Wed, 29 May 2013 20:02:03 +0000</pubDate>
		<dc:creator>garett</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Platform Services]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[push]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=15167</guid>
		<description><![CDATA[Push has always been a major part of BlackBerry as an extremely efficient way of providing real-time data to users without needing to keep your app running at all times. The main components of Push from BlackBerry 7 to BlackBerry 10 have remained largely unchanged, with applications needing to: Register to receive push messages with [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=15167&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Push has always been a major part of BlackBerry as an extremely efficient way of providing real-time data to users without needing to keep your app running at all times. The main components of Push from BlackBerry 7 to BlackBerry 10 have remained largely unchanged, with applications needing to:</p>
<ol>
<li>Register to receive push messages with the device</li>
<li>Register with the BlackBerry Push Service in the cloud to allow push messages for the app to begin being delivered</li>
<li>Register with your server side app so it knows there’s a new subscriber</li>
<li>Be ready to receive push messages at any time</li>
<li>Process pushes in a quick and efficient manner</li>
</ol>
<p>The server-side portion of consumer push is <strong>identical</strong> between all BlackBerry smartphone versions, meaning you can use your current server-side app and push service credentials.</p>
<p><img alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2013/05/pushporting.png?w=450&#038;h=300" width="450" height="300" /></p>
<p style="text-align:center;"><i>By włodi from London, UK (The Big Red Button Uploaded by Yarl) [CC-BY-SA-2.0 (<a href="http://creativecommons.org/licenses/by-sa/2.0" rel="nofollow">http://creativecommons.org/licenses/by-sa/2.0</a>)%5D, via Wikimedia Commons</i></p>
<h4><strong>BlackBerry 7</strong></h4>
<p>In BlackBerry 7 Java, there were two main ways to set up your application to receive push messages &#8211; open a port and begin listening indefinitely or register your port and application details with the device. The former basically required that your application begin a background process when the app was first installed, as well as every time the device started up. When the push arrived on the port opened by the app, the data could then be processed however required by the app, followed by the app once again listening on the open port for the next message. This method also required the app to perform “manual” registration, an HTTP POST, with the BlackBerry Push Service to allow devices to begin receiving push messages for your app.</p>
<p><a href="https://github.com/blackberry/JDE-Samples/tree/master/com/rim/samples/device/httppushdemo" target="_blank"><br />
https://github.com/blackberry/JDE-Samples/tree/master/com/rim/samples/device/httppushdemo<br />
</a> (this sample shows Enterprise Push which is similar to the pre-5.0 Push API method through BIS)</p>
<p>The latter approach was introduced in BlackBerry 5 where new APIs were introduced that removed the need to keep an app thread running at all times. Instead, the app would register itself with the device by passing it the assigned port and push app ID, allowing the device to listen for push messages on behalf of the app and launch to pass the push message to be processed. This method provided a simple way to allow the app to perform the registration with the BlackBerry Push Service.</p>
<p><a href="http://www.blackberry.com/developers/docs/7.0.0api/net/rim/blackberry/api/push/package-frame.html" target="_blank"><br />
http://www.blackberry.com/developers/docs/7.0.0api/net/rim/blackberry/api/push/package-frame.html<br />
</a></p>
<h4><strong>BlackBerry 10</strong></h4>
<p>The approach used in BlackBerry 10 is most similar to the last approach mentioned for BlackBerry 7 and is arguably the simplest way to handle push messages yet. One simplification is that developers no longer need to worry about application ports, as the on-device service will now handle port selection directly with the BlackBerry Push Service. Another is that rather than needing to deal with reading network streams to receive the push payload, it is not delivered directly to the app fully available in the data portion of an invocation.</p>
<p><span style="text-decoration:underline;">Application flow</span></p>
<p>The first thing your app will need is an entry in the bar-descriptor.xml file that registers the app to receive invocations from the device push notification service. Below is an example entry. The only thing you need to change is the invoke-target id value to a string unique to your app:</p>
<pre>          <strong>    &lt;invoke-target id="com.unique.string.for.your.app"&gt;	
      &lt;type&gt;APPLICATION&lt;/type&gt;
      &lt;filter&gt;
         &lt;action&gt;bb.action.PUSH&lt;/action&gt;
         &lt;mime-type&gt;application/vnd.push&lt;/mime-type&gt;
      &lt;/filter&gt;
    &lt;/invoke-target&gt;
</strong></pre>
<p>The second thing to add to the bar-descriptor is the permission for consumer push (this can also be added through the GUI editor in the IDE):</p>
<p><strong>&lt;permission system=&#8221;true&#8221;&gt;_sys_use_consumer_push&lt;/permission&gt;</strong></p>
<p>After the above entries exist, we are ready to start programming. Using the various Push APIs, the following flow needs to occur in the device app:</p>
<p><span style="text-decoration:underline;">Create a Session</span></p>
<p>Frequency: Every time your app launches</p>
<p>This is where your app registers itself to receive push messages. Once your app passes the on-device service, it’s provided a push app ID as well as the invoke-target ID you specified in the bar-descriptor file. This basically tells the service, “If a push comes in with this push app ID, invoke my app using this invoke-target ID”.</p>
<p><strong>PushService* m_pushService;</strong> //Member variable creation in header file</p>
<p>//In this case BLACKBERRY_INVOKE_TARGET_ID would be &#8220;com.unique.string.for.your.app&#8221; from above</p>
<p><strong>m_pushService = new PushService(BLACKBERRY_PUSH_APPLICATION_ID, BLACKBERRY_INVOKE_TARGET_ID);<br />
m_pushService-&gt;createSession();</strong></p>
<p><span style="text-decoration:underline;">Create a Channel</span></p>
<p>Frequency: Once for the lifetime of the app</p>
<p>After the session has been established on the device, the app then needs to register itself with the BlackBerry Push Service. This operation is referred to as “creating a channel”. The creation of a channel tells the BlackBerry Push Service, “If a push message arrives with this app ID and is addressed to my device, please let it through”. Without this step, pushes will never be delivered to the device.</p>
<p><strong>m_pushService-&gt;createChannel(QUrl(BLACKBERRY_PUSH_URL));</strong></p>
<p>Another important part of this step is that when the channel is created, it should return a “token” which currently is simply the value of the device PIN. This can be sent to your server once retrieved to let it know that a new device has subscribed.</p>
<p><span style="text-decoration:underline;">Register to Launch</span></p>
<p>Frequency: Once for the lifetime of the app</p>
<p>Following the channel creation, your last step is to call the “register to launch” function. Unlike BlackBerry 7, BlackBerry 10 apps do not run all the time. When a push arrives however, the application can be launched into the tiled state to perform processing on the push it’s not already running. In order to be launched when a push arrives, the app must call the “register to launch” function. Otherwise if this function is not called and the application is closed, the push data will be lost.</p>
<p><strong>m_pushService-&gt;registerToLaunch();</strong></p>
<p>Once the above steps are completed, your app is ready to start receiving push messages. As push uses invocation, you can handle the messages in about the same way you would for a standard invocation of your app:<br />
<a href="https://developer.blackberry.com/cascades/documentation/device_platform/invocation/receiving_invocation.html" target="_blank"><br />
https://developer.blackberry.com/cascades/documentation/device_platform/</p>
<p>invocation/receiving_invocation.html</a></p>
<p>The one difference is that you need to use the PushPayload class to retrieve the push payload from the InvokeRequest’s data:<br />
<a href="https://developer.blackberry.com/cascades/documentation/device_comm/push/cs_receiving_a_push_message.html" target="_blank"><br />
https://developer.blackberry.com/cascades/documentation/device_comm/push/</p>
<p>cs_receiving_a_push_message.html</a></p>
<p>Ready to get porting your BlackBerry Java push app over to BlackBerry 10? Here’s a great resource that walks through the entire service including lots of code snippets:<br />
<a href="https://developer.blackberry.com/cascades/documentation/device_comm/push/index.html" target="_blank"><br />
https://developer.blackberry.com/cascades/documentation/device_comm/push/index.html<br />
</a></p>
<p>Need a sample to test your current push credentials? Check our GitHub repositories:<br />
<a href="https://github.com/blackberry/Cascades-Samples" target="_blank"><br />
https://github.com/blackberry/Cascades-Samples<br />
</a><br />
<a href="https://github.com/blackberry/Cascades-Community-Samples" target="_blank"><br />
https://github.com/blackberry/Cascades-Community-Samples<br />
</a></p>
<p>Never used Push before? Check out this overview of the service:<br />
<a href="https://developer.blackberry.com/services/push/?CPID=PUSHAPI00" target="_blank"><br />
https://developer.blackberry.com/services/push/?CPID=PUSHAPI00<br />
</a></p>
<p>If you still have questions toss a post in the Push Development forums or send me a tweet:<br />
<a href="http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/bd-p/Applications_using_Push_Technology" target="_blank"><br />
http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/bd-p/Applications_using_Push_Technology<br />
</a></p>
<p><a href="https://twitter.com/garettBeuk" target="_blank">@garettBeuk</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/15167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/15167/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=15167&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/05/cascades-porting-series-push-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75e7e69af37da351a3462a17576c2209?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gbeuk</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/05/pushporting.png?w=450" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 5: User Interface</title>
		<link>http://devblog.blackberry.com/2013/03/blackberry-java-to-blackberry-10-cascades-porting-series-part-5-user-interface/</link>
		<comments>http://devblog.blackberry.com/2013/03/blackberry-java-to-blackberry-10-cascades-porting-series-part-5-user-interface/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 19:12:42 +0000</pubDate>
		<dc:creator>suavekz</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[porting]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=14348</guid>
		<description><![CDATA[In this part of the series on porting BlackBerry Java applications to BlackBerry 10 using Cascades, we’ll examine the user interface.. Let’s take a side by side look at the UI components in both frameworks. The Cascades framework is a rich and powerful modern UI framework build on top of the Qt application framework. The [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=14348&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this part of the series on porting BlackBerry Java applications to BlackBerry 10 using <a href="http://developer.blackberry.com/cascades" target="_new">Cascades</a>, we’ll examine the user interface.. Let’s take a side by side look at the UI components in both frameworks.</p>
<p>The Cascades framework is a rich and powerful modern UI framework build on top of the Qt application framework. The UI can be developed in C/C++ or Qt Modeling Language (QML) or both.</p>
<p>Lets take a look at a sample HelloWorld application in both frameworks:</p>
<p>HelloWorld side-by-side. A label in both Java and Cascades</p>
<table>
<tbody>
<tr>
<td>
<pre>// MAIN: the setup
public static void main(String[] args)    
{
      HelloApp app = new HelloApp();
      app.enterEventDispatcher();

}</pre>
</td>
<td>
<pre>	// MAIN: the setup
Q_DECL_EXPORT int main
(int argc, char **argv)
{
   Application app(argc, argv);
   new HelloWorld(&amp;app);
   return Application::exec();
}</pre>
</td>
</tr>
<tr>
<td>
<pre>// HELLO WORLD CLASS

public class HelloApp extends
   UiApplication {
public HelloApp () {
 HScreen scr = new HScreen();
  pushScreen( scr );
      }</pre>
</td>
<td>
<pre>	// HELLO WORLD CLASS

HelloWorld::HelloWorld 
(bb::cascades::Application *app)
: QObject(app)
{
    QmlDocument *qml = 
QmlDocument::create("asset:///main.qml")
.parent(this);

    // create root object for the UI
    AbstractPane *root = 
qml-&gt;createRootObject();
    app-&gt;setScene(root);
}</pre>
</td>
</tr>
<tr>
<td>
<pre>// SCREEN CLASS: THE UI

public class HScreen 
extends MainScreen {

  private LabelField lbl;
  public HScreen()
  {
    lbl = new   LabelField( "Welcome!" );

    add( lbl );</pre>
</td>
<td>
<pre>  }}	// QML Page : THE UI

Page {
    Container {
        layout: DockLayout {}
        Label {
            text: qsTr("Hello World")
}}}</pre>
</td>
</tr>
</tbody>
</table>
<p>Both frameworks start with the main application and the HelloWorld class. In the case of Java a screen gets pushed on the screen stack. In the case of Cascades a QML document gets associated with root UI object.</p>
<p>In Java, a Screen Class gets created by extending MainScreen and adding a LabelField to it. In Cascades a Page gets declared and a Label is placed inside a container as shown on the screen.</p>
<p>When embarking on porting any application that include the User Interface. It’s important to review the UI guidelines for both platforms.</p>
<p>The BlackBerry Java UI guidelines can be found at:<br />
<a href="https://developer.blackberry.com/design/bb7/" target="_new"><br />
https://developer.blackberry.com/design/bb7/<br />
</a></p>
<p>The BlackBerry 10 UI guidelines can be found at:<br />
<a><br />
<a href="https://developer.blackberry.com/design/bb10/" rel="nofollow">https://developer.blackberry.com/design/bb10/</a><br />
</a></p>
<h3><strong>A note on Java UI</strong></h3>
<p>The BlackBerry Java Development Environment (JDE) or the Eclipse Plugin is used to develop applications for BlackBerry OS 7.1 or lower.</p>
<p>There are two main supported frameworks for creating user interfaces in Java:</p>
<ul>
<li>MIDP UI APIs</li>
<li>BlackBerry UI APIs</li>
</ul>
<p>For compliance, the MIDP APIs are included for porting apps from MIDP devices. The BlackBerry UI APIs target specifically BlackBerry development and are the main focus of this article.</p>
<h3><strong>Rendering in Java And Cascades UI Frameworks </strong></h3>
<p>In Java UI rendering is done in “widgets” using the paint() functions. Normally, a list of such “widgets” will represent your entire UI. The system will go through the entire set of “widgets” and ask them to draw themselves by calling the “paint()” method. The consequences of this implementation are as follows:</p>
<table>
<tbody>
<tr>
<td>Customization: You can override the paint() method. This leads to inconsistency in the UI.</td>
<td>This is in fact how many Java UI custom components are created. This is usually an advanced activity involving drawing lines, circles and rectangles to get the desired UI look and effect.<br />
The end result is that each application can have completely different looking UI components that behave differently.</td>
</tr>
<tr>
<td>Side Effects: UI can block</td>
<td>If the paint() method is slow or the developer implemented their own custom component and their own paint(), the system UI can block executing a slow paint() function in one of the widgets.</td>
</tr>
<tr>
<td>Performance: Overdraw</td>
<td>For party covered or obscured widgets, the system first has to draw the entire widget and then overdraw several times. This results in performance penalty.</td>
</tr>
</tbody>
</table>
<p>In Cascades, rendering is done differently. Unlike in Java where the application is part of the rendering loop a Cascades application only manages the UI tree. The Cascades Rendering engine (which executes on a separate thread) takes care of drawing the UI. The consequences of this implementation are as follows:</p>
<table>
<tbody>
<tr>
<td>Customization: You cannot override the paint() method which leads to UI <strong>Consistency</strong>.</td>
<td>Every Cascades component is carefully crafted. These components blend and flow together and were designed to be used together. No cascades component is an island in and of itself. Thus Cascades <strong>custom</strong> components are usually <strong>composed</strong> of other existing components.</td>
<td></td>
</tr>
<tr>
<td>Side Effects: UI cannot block. No more hour-glassing during rendering!</td>
<td>Slow running application has no ability to block the UI. The speed of rendering depends on the complexity of the UI tree and the ability of the application to provide data to the renderer fast enough.</td>
</tr>
<tr>
<td>Performance: GPU optimizations</td>
<td>UI engine can get a holistic view of the entire user interface. This results in many GPU texture and state optimizations.</td>
</tr>
</tbody>
</table>
<p>For more information on the topic please see this blog post.</p>
<p>(<a href="http://devblog.blackberry.com/2012/09/cascades-custom-ui/" target="_new"><br />
http://devblog.blackberry.com/2012/09/cascades-custom-ui/<br />
</a>)</p>
<h3><strong>Navigation:</strong></h3>
<p><strong>Single Screen</strong></p>
<p>Normally a single screen Java application would extend from MainScreen as in the HelloWorld sample provided. Similarly in Cascades a Page would get created with individual components added to it.</p>
<table>
<tbody>
<tr>
<td><strong>Screen</strong></td>
<td><strong>Page</strong></td>
</tr>
<tr>
<td><img class="aligncenter size-full wp-image-14359" alt="Image1" src="http://rimdevblog.files.wordpress.com/2013/03/image1.jpg?w=173&#038;h=129" width="173" height="129" /></td>
<td><img class="aligncenter size-medium wp-image-14360" alt="Image2" src="http://rimdevblog.files.wordpress.com/2013/03/image2.jpg?w=188&#038;h=300" width="188" height="300" /></td>
</tr>
</tbody>
</table>
<p><strong>Stack of Screens</strong></p>
<p>In traditional Java applications flow is maintained by adding and removing screens to/from the stack, which is owned by the main application. The equivalent to this on BlackBerry 10 is the Navigation pane where individual pages can be pushed and popped from a stack. For more information on Cascades Navigation Pane please see: <a href="http://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html" target="_new"><br />
http://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html<br />
</a></p>
<table>
<tbody>
<tr>
<td><strong>Screen, MainScreen, FullScreen </strong></td>
<td><strong>             NavigationPane</strong></td>
</tr>
<tr>
<td>The screen transitions occur through push/pop from the screen stack</p>
<p style="text-align:center;"><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image3.jpg" /></p>
</td>
<td>Navigation pane maintains a stack of screens</p>
<p style="text-align:center;"><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image4.jpg?w=300" /></p>
</td>
</tr>
</tbody>
</table>
<p><strong>Tabs and Filtering content</strong></p>
<p>In Java applications Tabs are used to display filtered content and are achieved with the PaneManagerModel. This can be achieved in Cascades using Segmented Control.</p>
<p>Cascades tabs allow the apps to change the flow of the application. In BlackBerry Java, this effect was achieved through the use of custom components.</p>
<table>
<tbody>
<tr>
<td>PaneManagerModel, Pane, HorizontalTabTitleView, PaneView, PaneManagerView</td>
<td>SegmentedControl<br />
<a href="http://developer.blackberry.com/cascades/reference/bb__cascades__segmentedcontrol.html" target="_new"><br />
http://developer.blackberry.com/cascades</p>
<p>/reference/bb__cascades__segmentedcontrol.html</a></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image5.jpg?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image6.jpg?w=200" /></td>
</tr>
<tr>
<td>Custom Component implementing custom Toolbar<a><br />
<a href="http://docs.blackberry.com/en/developers/" rel="nofollow">http://docs.blackberry.com/en/developers/</a></p>
<p>deliverables/17965/Toolbars_6_0_1137042_11.jsp</a></td>
<td>Tabbed Pane<a href="http://developer.blackberry.com/cascades/reference/bb__cascades__tabbedpane.html" target="_new"><br />
http://developer.blackberry.com/cascades</p>
<p>/reference/bb__cascades__tabbedpane.html</a></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image7.jpg?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image8.jpg" /></td>
</tr>
</tbody>
</table>
<h3><strong>Layout</strong></h3>
<p><strong>Java:</strong></p>
<p><a href="http://btsc.webapps.blackberry.com/btsc/fetch/2000/348583/800332/800505/800508/How_To_-_Create_tabbed_view_screens.html?nodeid=1357482&amp;vernum=0"><br />
http://btsc.webapps.blackberry.com/btsc/fetch/2000/348583/800332/800505/800508/How_To_-_Create_tabbed_view_screens.html?nodeid=1357482&#038;vernum=0<br />
</a></p>
<p><strong>Cascades:</strong></p>
<p><a><br />
<a href="http://developer.blackberry.com/cascades/reference/user_interface_layouts.html" rel="nofollow">http://developer.blackberry.com/cascades/reference/user_interface_layouts.html</a><br />
</a></p>
<p>The following tables illustrate layout mapping of the most frequently used layouts.</p>
<p>In BlackBerry Java, the most common approach is to use combination of HorizontalFieldManager and VerticalFieldManager. This can be achieved in Cascades using the DockLayout.</p>
<table>
<tbody>
<tr>
<td>FlowFieldManager</td>
<td>Stack Layout default behavior</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image9.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image10.png" /></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>HorizontalFieldmanager</td>
<td>Stack Layout with LayoutProperties<br />
and spaceQuota</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>VerticalFieldManager</td>
<td>Stack Layout with each component having<br />
HorizontalAlignment.Center</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Combination of Horizontal<br />
and Vertical Field Managers</td>
<td>Dock Layout</td>
</tr>
<tr>
<td></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image11.png" /></td>
</tr>
</tbody>
</table>
<p>AbsoluteLayout</p>
<table>
<tbody>
<tr>
<td>AbsoluteFieldManager</td>
<td>AbsoluteLayout</td>
</tr>
</tbody>
</table>
<h3><strong>Menus:</strong></h3>
<p>The Java Menus documentation can be referenced at:</p>
<p><a><br />
<a href="http://developer.blackberry.com/java/documentation/menu_items_1970228_11.html" rel="nofollow">http://developer.blackberry.com/java/documentation/menu_items_1970228_11.html</a><br />
</a></p>
<p>The Cascades Menus can be reference at:</p>
<p><a href="http://developer.blackberry.com/cascades/documentation/ui/navigation/menus.html" target="_new"><br />
http://developer.blackberry.com/cascades/documentation/ui/navigation/menus.html<br />
</a></p>
<p>The most common way of interacting with content in BlackBerry Java was through the BlackBerry Menu (the hardware key). On BlackBerry 10, Cascades applications would use an action in the action menu to get the equivalent functionality.</p>
<p>BlackBerry Key Menu vs. BlackBerry 10 Action Menu</p>
<table>
<tbody>
<tr>
<td><strong>Menu (Screenshot)</strong></td>
<td><strong>ActionSet</strong></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image12.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image13.png?w=200" /></td>
</tr>
</tbody>
</table>
<p>Application “Settings” Menu. [BlackBerry 10 Only]</p>
<p>A swipe-down menu is accessible on BlackBerry 10 for <strong>infrequently</strong> used actions such as settings, getting customer information, managing accounts or downloads etc…</p>
<table>
<tbody>
<tr>
<td>N/A</td>
<td>Menu class and ActionItem object</td>
</tr>
<tr>
<td></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image14.png?w=200" /></td>
</tr>
</tbody>
</table>
<p><strong>Context Menu</strong></p>
<p>Context menu is a common BlackBerry specific method of acting upon an item in a specific context. This can be achieved on both platforms as illustrated below.</p>
<table>
<tbody>
<tr>
<td>Context Menu</td>
<td>contextActions</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image15.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image16.png?w=200" /></td>
</tr>
</tbody>
</table>
<p><strong>Custom Menu</strong></p>
<p>In certain cases you might want to create a completely custom menu that makes sense for your application. This is possible in BlackBerry 10 using the MenuManager API.</p>
<table>
<tbody>
<tr>
<td>Override keyDown and then<br />
create a custom component to display on the screen.</td>
<td>MenuManager</td>
</tr>
<tr>
<td></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/image17.png" /></td>
</tr>
</tbody>
</table>
<h3><strong>Active Home Screen Elements</strong></h3>
<p>In BlackBerry Java, apps would normally change the icons and the icon descriptions to keep track of the application state. For more information on the APIs please see:</p>
<p><a href="http://www.blackberry.com/developers/docs/7.1.0api/" target="_new"><br />
http://www.blackberry.com/developers/docs/7.1.0api/<br />
</a></p>
<p>In BlackBerry 10, apps would use Active Frames to update the status of an application. For more information of Active Frames please see:</p>
<p><a><br />
<a href="http://developer.blackberry.com/cascades/documentation/ui/active_frames/index.html" rel="nofollow">http://developer.blackberry.com/cascades/documentation/ui/active_frames/index.html</a><br />
</a></p>
<p>Active Home Screen App Elements</p>
<table>
<tbody>
<tr>
<td>Active Icons</td>
<td>Active Frames</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/18.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/19.png?w=200" /></td>
</tr>
</tbody>
</table>
<p><strong>Notifications</strong></p>
<p>To learn more about BlackBerry 7 notifications please see:</p>
<p><a href="https://developer.blackberry.com/java/documentation/message_list_1984778_11.html" target="_new"><br />
https://developer.blackberry.com/java/documentation/message_list_1984778_11.html<br />
</a></p>
<p>To learn more about BlackBerry 10 hub notifications please see:</p>
<p><a href="https://developer.blackberry.com/cascades/documentation/device_comm/notifications/index.html" target="_new"><br />
https://developer.blackberry.com/cascades/documentation/device_comm/notifications/index.html<br />
</a></p>
<table>
<tbody>
<tr>
<td style="text-align:center;"><strong>MessageList</strong></td>
<td style="text-align:center;"><strong>Hub Notifications</strong></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/20.png" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/21.png?w=200" /></td>
</tr>
</tbody>
</table>
<p><strong>Popup Dialogs</strong></p>
<table>
<tbody>
<tr>
<td style="text-align:center;"><strong>DialogFieldManager and PopupManager</strong></td>
<td style="text-align:center;"><strong>NotificationDialog</strong></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/22.png" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/23.png?w=185" /></td>
</tr>
</tbody>
</table>
<h3><strong>Custom Controls</strong></h3>
<p>In BlackBerry Java, custom controls are challenging to implement and often involve overriding the paint() method of native components. For more information and samples please see:</p>
<p><a href="https://developer.blackberry.com/java/documentation/advanced_ui_components_and_managers_1970227_11.html" target="_new"><br />
https://developer.blackberry.com/java/documentation/</p>
<p>advanced_ui_components_and_managers_1970227_11.html</a></p>
<p>In Cascades, custom controls are created by combining existing components and modifying their behavior. For more information on how to create a custom control in Cascades, please see:</p>
<p><a href="http://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/custom_control_tutorial.html" target="_new"><br />
http://developer.blackberry.com/cascades/documentation/</p>
<p>dev/integrating_cpp_qml/custom_control_tutorial.html</a></p>
<table>
<tbody>
<tr>
<td><strong>Sample Use of Custom Components</strong></td>
<td><strong>Custom Control </strong></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/24.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/25.png?w=200" /></td>
</tr>
</tbody>
</table>
<h3><strong>Dialog Boxes, Prompts, Toasts</strong></h3>
<p>The BlackBerry Java platform supports Dialogs of different format (information, status, inquiry). For information on dialog boxes please see:</p>
<p><a href="http://developer.blackberry.com/java/documentation/dialog_boxes_1970203_11.html" target="_new"><br />
http://developer.blackberry.com/java/documentation/dialog_boxes_1970203_11.html<br />
</a></p>
<p>Cascades supports dialog boxes, prompts and toasts. For more information on how to implement them please see:</p>
<p><a href="http://developer.blackberry.com/cascades/documentation/ui/dialogs_toasts/index.html" target="_new"><br />
http://developer.blackberry.com/cascades/documentation/ui/dialogs_toasts/index.html<br />
</a></p>
<table>
<tbody>
<tr>
<td>Dialog Class</td>
<td>Dialog, SystemDialog, SystemListDialog …<br />
Below is an example of a custom dialog box.</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/26.png" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/27.png?w=182" /></td>
</tr>
</tbody>
</table>
<h3><strong>Lists</strong></h3>
<p>For reference of List implementations in Java please see:</p>
<p><a href="http://developer.blackberry.com/java/documentation/lists_and_tables_1970216_11.html" target="_new"><br />
http://developer.blackberry.com/java/documentation/lists_and_tables_1970216_11.html<br />
</a></p>
<p>For list implementation in Cascades please see:</p>
<p><a href="http://developer.blackberry.com/cascades/documentation/ui/lists/" target="_new"><br />
http://developer.blackberry.com/cascades/documentation/ui/lists/<br />
</a></p>
<p><strong>Active Home Screen App Elements</strong></p>
<table>
<tbody>
<tr>
<td>SimpleList, RichList, TableView</td>
<td>ListView</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/28.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/29.png?w=200" /></td>
</tr>
</tbody>
</table>
<h3><strong>Text</strong></h3>
<p>For reference on how to handle text in Cascades please see:</p>
<p><a><br />
<a href="http://developer.blackberry.com/cascades/documentation/ui/text/index.html" rel="nofollow">http://developer.blackberry.com/cascades/documentation/ui/text/index.html</a><br />
</a></p>
<p><strong>Label</strong></p>
<table>
<tbody>
<tr>
<td>Label<a href="http://developer.blackberry.com/java/documentation/text_field_label_1984828_11.html" target="_new"><br />
http://developer.blackberry.com/java/</p>
<p>documentation/text_field_label_1984828_11.html</a></td>
<td>Label</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/30.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/31.png" /></td>
</tr>
</tbody>
</table>
<p><strong>Text Field</strong></p>
<table>
<tbody>
<tr>
<td>LabelField, RitchTextField, BasicEditField, PasswordEditField, EmailAddressEditField, KeywordFilterField, AutoTextEditField</td>
<td>TextField with TextFieldInputMode<br />
Of type:<br />
<a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-default" target="_new">Default, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-text" target="_new">Text, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-emailaddress" target="_new">EmailAddress, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-password" target="_new">Password, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-chat" target="_new">Chat, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-url" target="_new">Url, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-phonenumber" target="_new">PhoneNumber, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-numbersandpunctuation" target="_new">NumbersAndPunctuation,</a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-numericpassword" target="_new">NumericPassword, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html#enumvalue-pin" target="_new">Pin </a></td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/32.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/33.png" /></td>
</tr>
</tbody>
</table>
<p><strong>Text Area</strong></p>
<table>
<tbody>
<tr>
<td>RitchTextField and ActiveRitchTextField</td>
<td>TextArea with TextAreaInputMode of type:<br />
<a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textareainputmode.html#enumvalue-default" target="_new">Default, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textareainputmode.html#enumvalue-text" target="_new">Text, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textareainputmode.html#enumvalue-chat" target="_new">Chat, </a><a href="http://developer.blackberry.com/cascades/reference/bb__cascades__textareainputmode.html#enumvalue-emailaddress" target="_new">EmailAddress </a></td>
</tr>
<tr>
<td></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/34.png" /></td>
</tr>
</tbody>
</table>
<h3><strong>Web Content</strong></h3>
<p><strong>WebView</strong></p>
<table>
<tbody>
<tr>
<td>BrowserField<br />
<a href="//www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/browser/field2/BrowserField.html" target="_new;"><br />
http://www.blackberry.com/developers/</p>
<p>docs/7.1.0api/net/rim/device/api/<br />
browser/field2/BrowserField.html</a></p>
<pre>BrowserField  BrowserField browserField = 
new BrowserField();
screen.add( browserField ); 
browserField.requestContent
( "http://blackberry.com" );</pre>
</td>
<td>WebView<br />
<a href="http://developer.blackberry.com/cascades/reference/bb__cascades__webview.html" target="_new"><br />
http://developer.blackberry.com/</p>
<p>cascades/reference/bb__cascades<br />
__webview.html</a></p>
<pre>WebView {
    id: webView
    url: " http://blackberry.com "
}</pre>
</td>
</tr>
<tr>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/35.png?w=200" /></td>
<td><img alt="" src="http://rimdevblog.files.wordpress.com/2013/03/36.png" /></td>
</tr>
</tbody>
</table>
<p></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/14348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/14348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=14348&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/03/blackberry-java-to-blackberry-10-cascades-porting-series-part-5-user-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/da12ace9c233f2b65ec288ed8ff59f06?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">suavekz</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image1.jpg" medium="image">
			<media:title type="html">Image1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image2.jpg?w=188" medium="image">
			<media:title type="html">Image2</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image3.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image4.jpg?w=300" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image5.jpg?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image6.jpg?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image7.jpg?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image8.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image9.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image10.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image11.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image12.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image13.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image14.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image15.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image16.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/image17.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/18.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/19.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/20.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/21.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/22.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/23.png?w=185" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/24.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/25.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/26.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/27.png?w=182" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/28.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/29.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/30.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/31.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/32.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/33.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/34.png" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/35.png?w=200" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/36.png" medium="image" />
	</item>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 4: Multimedia</title>
		<link>http://devblog.blackberry.com/2013/03/cascades-porting-series-multimedia/</link>
		<comments>http://devblog.blackberry.com/2013/03/cascades-porting-series-multimedia/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 13:31:27 +0000</pubDate>
		<dc:creator>Paul Bernhardt</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[BlackBerry 7]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[porting]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=14214</guid>
		<description><![CDATA[Multimedia on BlackBerry 7 was based on the multimedia JSR (135). There were a lot of limitations regarding supported formats, how many sounds could be played at the same time, and even what worked on which device. In BlackBerry 10, there are a wide range of supported codecs, containers, and protocols. For video, we recommend [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=14214&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div id="attachment_14224" class="wp-caption aligncenter" style="width: 260px"><a href="http://giphy.com/gifs/TznYiZCFXeLle"><img class="size-full wp-image-14224" alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2013/03/original.gif?w=250&#038;h=195" width="250" height="195" /></a><p class="wp-caption-text"><a href="http://giphy.com/gifs/TznYiZCFXeLle" target="_blank"><br />
http://giphy.com/gifs/TznYiZCFXeLle<br />
</a></p></div>
<p>Multimedia on BlackBerry 7 was based on the multimedia JSR (135). There were a lot of limitations regarding supported formats, how many sounds could be played at the same time, and even what worked on which device.</p>
<p>In BlackBerry 10, there are a wide range of supported <a href="https://developer.blackberry.com/develop/supported_media/bb10_media_support.html" target="_new">codecs, containers</a>, and <a href="https://developer.blackberry.com/devzone/develop/supported_media/bb10_pbos_streaming_support.html" target="_new">protocols</a>.</p>
<p>For video, we recommend an MP4 containing H.264 video at 720p and AAC audio. For audio, it depends a lot on your use case. In addition to mainstays such as MP3 and AAC, we support things like <a href="http://flac.sourceforge.net/" target="_new">FLAC</a> and <a href="http://www.vorbis.com/" target="_new">Ogg Vorbis</a>.</p>
<p>To actually play your multimedia, you should be looking at the <a href="https://developer.blackberry.com/cascades/reference/bb__multimedia__mediaplayer.html" target="_new">MediaPlayer</a> class. That will handle audio or video. You can also easily play the built in system sounds with the <a href="https://developer.blackberry.com/cascades/reference/bb__multimedia__systemsound.html" target="_new">SystemSound</a> class.</p>
<ul>
<li><a href="https://developer.blackberry.com/cascades/documentation/design/audio_video/playing_audio_or_video.html" target="_new">Tutorial: Playing Audio or Video</a></li>
<li><a href="https://developer.blackberry.com/cascades/documentation/design/audio_video/playing_system_sounds_in_an_app_tutorial.html" target="_new">Tutorial: Playing SystemSounds in an app</a></li>
</ul>
<p>Recording audio is through the AudioRecorder class. You can record a few different formats, including AAC (.mp4) and PCM (.wav).</p>
<ul>
<li><a href="https://developer.blackberry.com/cascades/reference/bb__multimedia__audiorecorder.html" target="_new">Recording Audio</a></li>
</ul>
<p>This is all pretty straightforward and should be pretty easy to adjust to if you are used to the Java way of doing things. There are a few key differences that you might not be expecting though.</p>
<p>The first is the <a href="https://developer.blackberry.com/cascades/reference/bb__multimedia__nowplayingconnection.html" target="_new">NowPlayingConnection</a>. If you are building any sort of media player type application: use it. What it does is let the user control the volume and playback of your app from in another app, using the volume keys on the side. You can also provide a bit of data like a thumbnail image and the current song playing. No user is going to want to have to go back into your application just to change the volume, and it’s really easy to implement.</p>
<ul>
<li><a href="https://developer.blackberry.com/cascades/documentation/design/audio_video/working_with_the_nowplayingconnection.html" target="_new">Working with NowPlayingConnection</a></li>
</ul>
<p>Secondly, unlike in BlackBerry 7, in BlackBerry 10 you can enable echo cancellation in order to do VoIP. There is no convenient Qt API to do this, but you can use <a href="http://developer.blackberry.com/native/reference/bb10/audio_libref/topic/summary.html" target="_new">QSA</a> and <a href="http://developer.blackberry.com/native/reference/bb10/audio_libref/topic/libs/snd_pcm_open_name.html" target="_new">open a connection</a> to the “voice” PCM audio interface.</p>
<ul>
<li><a href="http://devblog.blackberry.com/2013/01/blackberry-10-voip/" target="_new">BlackBerry 10 VoIP</a></li>
</ul>
<p>The other big difference is that you can’t just feed bytes directly into the media player. You need to have an actual file to play, or be using one the streaming protocols supported. Of course, there is nothing stopping you from dropping down to <a href="http://connect.creativelabs.com/openal/default.aspx" target="_new">OpenAL/ALUT</a> and doing whatever you need if that’s your style. You also have <a href="http://developer.blackberry.com/native/reference/bb10/audio_libref/topic/summary.html" target="_new">QSA</a> available as mentioned before, as well as <a href="http://developer.blackberry.com/native/reference/bb10/mmrenderer_libref/topic/about.html" target="_new">mm-renderer</a> (which is what MediaPlayer is using), but that is all beyond the scope of this article.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/14214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/14214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=14214&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/03/cascades-porting-series-multimedia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a3bf8c930434e9f401be449eb7ea556?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulbe1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/03/original.gif" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 3: Networking</title>
		<link>http://devblog.blackberry.com/2013/02/java-to-cascades-part-3/</link>
		<comments>http://devblog.blackberry.com/2013/02/java-to-cascades-part-3/#comments</comments>
		<pubDate>Mon, 25 Feb 2013 14:53:20 +0000</pubDate>
		<dc:creator>Paul Bernhardt</dc:creator>
				<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[BlackBerry 7]]></category>
		<category><![CDATA[Cascades]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=13908</guid>
		<description><![CDATA[Networking in BlackBerry 7 OS was based on the Connector.open() paradigm, where you would specify the protocol and transport in the connection string (“http://www.example.com;deviceside=true”), and get back a Connection object of a certain type (HttpConnection, for example). Networking in BlackBerry 10 is done through the QNetwork module. You no longer need to worry about transport [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13908&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Networking in BlackBerry 7 OS was based on the Connector.open() paradigm, where you would specify the protocol and transport in the connection string (“http://www.example.com;deviceside=true”), and get back a Connection object of a certain type (HttpConnection, for example).</p>
<p><a href="https://developer.blackberry.com/cascades/documentation/device_comm/networking/index.html">Networking</a> in BlackBerry 10 is done through the <a href="https://developer.blackberry.com/cascades/reference/qtnetwork.html" target="_new">QNetwork</a> module. You no longer need to worry about transport selection. Your typical HTTP communication can be handled through <a href="https://developer.blackberry.com/cascades/reference/qnetworkaccessmanager.html" target="_new">QNetworkAccessManager</a>. It provides methods such as get() and post(), which take a <a href="https://developer.blackberry.com/cascades/reference/qnetworkrequest.html" target="_new">QNetworkRequest</a> and then asynchronously return a <a href="https://developer.blackberry.com/cascades/reference/qnetworkreply.html" target="_new">QNetworkReply</a>.</p>
<p><strong>For example:</strong></p>
<pre>QUrl *url = new QUrl("http://www.iana.org/domains/example/");

    QNetworkAccessManager *manager = new QNetworkAccessManager(this);

    connect(manager, SIGNAL(finished(QNetworkReply*)),
    		this, SLOT(replyFinished(QNetworkReply*)));

    manager-&gt;get(QNetworkRequest(*url));</pre>
<p><strong>And then in your replyFinished slot:</strong></p>
<pre>void App::replyFinished(QNetworkReply* reply) {
	qDebug() &lt;readAll();

	// Call deleteLater to make sure the reply gets cleaned up
	reply-&gt;deleteLater();
}</pre>
<p>You can also do TCP with <a href="https://developer.blackberry.com/cascades/reference/qtcpsocket.html" target="_new">QTCPSocket</a> and <a href="https://developer.blackberry.com/cascades/reference/qtcpserver.html" target="_new">QTCPServer</a>, UDP with <a href="https://developer.blackberry.com/cascades/reference/qudpsocket.html">UDPSocket</a> , and FTP with <a href="https://developer.blackberry.com/cascades/reference/qftp.html" target="_new">QFtp</a>.</p>
<p>And of course, lower level <a href="http://developer.blackberry.com/native/reference/bb10/library_support_at_a_glance.html" target="_new">libraries</a> such as <a href="http://curl.haxx.se/" target="_new">cURL</a> are available if you should require them.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/13908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/13908/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13908&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/02/java-to-cascades-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a3bf8c930434e9f401be449eb7ea556?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulbe1</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 2: Application Life Cycle</title>
		<link>http://devblog.blackberry.com/2013/02/java-to-cascades-part-2/</link>
		<comments>http://devblog.blackberry.com/2013/02/java-to-cascades-part-2/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 16:16:29 +0000</pubDate>
		<dc:creator>Pratik S.</dc:creator>
				<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[Application Life Cycle]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[Cascades]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[porting]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=13902</guid>
		<description><![CDATA[Guest post from Roberto S. &#8211; Ed. In Part 2 of this series, we would like to introduce BlackBerry Java developers to what has changed with respect to application lifecycle in BlackBerry 10, and what you should be aware of when you port this aspect of your application to Cascades. All BlackBerry 10 applications have [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13902&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><P><I>Guest post from Roberto S. &#8211; Ed.</i></p>
<p>In Part 2 of this series, we would like to introduce BlackBerry Java developers to what has changed with respect to application lifecycle in BlackBerry 10, and what you should be aware of when you port this aspect of your application to Cascades.</p>
<p>All BlackBerry 10 applications have a similar lifecycle that includes three possible states: running in the foreground, running in the background, and stopped.</p>
<ul>
<li>An app <strong>running in the foreground</strong> is visible and is taking up the entire screen.</li>
<li>An app <strong>running in the background</strong> is either displayed as a thumbnail, such as when a user swipes up from the bottom of the screen to display a list of running apps, or is invisible but has the run_when_backgrounded permission to run in the background.</li>
<li>An app that is <strong>stopped</strong> is not visible and doesn&#8217;t have permission to run in the background.</li>
<li>An app that is <strong>pooled</strong> (the app is paused and ready to be opened in the foreground)</li>
</ul>
<p><span id="more-13902"></span></p>
<p style="text-align:center;"><img alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2013/02/applifecycle.jpg?w=450" /></p>
<p><img class="aligncenter size-full wp-image-13904" alt="AppLife" src="http://rimdevblog.files.wordpress.com/2013/02/applife.png?w=450&#038;h=405" width="450" height="405" /></p>
<p>Developers porting their apps from BlackBerry OS will need to take this into account and make the following changes to their apps:</p>
<ol>
<li>Unlike in BlackBerry OS, apps do not have an extra entry point available to them for starting up a background thread at startup, or for modifying theirs icons. Homescreen Icons are not modifiable in BlackBerry 10 so any such logic is not portable as is. However, the active frames feature allows developers to customize their frames when minimized. Therefore, this may allow some of the icon logic to be applied to the cover instead on a BlackBerry 10 version of the app. For more information about Active covers, go to <a href="https://developer.blackberry.com/cascades/documentation/ui/active_frames/index.html" target="_new"><br />
https://developer.blackberry.com/cascades/documentation/ui/active_frames/index.html<br />
</a> .</li>
<li>Background services capabilities are currently not available to third party developers. They will be available in a future release of BlackBerry 10. Developers relying on background services to poll servers for updates or execute code when they are not running will have to implement an alternative approach for the time being. The alternative currently recommended is to use push to launch your apps when new data is available. With Push, your server side application can poll for new data on behalf of the client application and deliver any new data in a push message which can be processed even if the client application is closed. Check out this recent blog post on push for more information: <a href="http://devblog.blackberry.com/2013/01/push-samples/" target="_new"><br />
http://devblog.blackberry.com/2013/01/push-samples/<br />
</a> .</li>
<li>To handle the life cycle changes that occur in your app, there are several signals made available to Cascades apps that an app developer can intercept and process accordingly. For more details on application lifecycle and the various signals available, go to <a href="https://developer.blackberry.com/cascades/documentation/dev/fundamentals/index.html" target="_new"><br />
https://developer.blackberry.com/cascades/documentation/dev/fundamentals/index.html<br />
</a> and <a href="https://developer.blackberry.com/cascades/reference/bb__application.html" target="_new"><br />
https://developer.blackberry.com/cascades/reference/bb__application.html<br />
</a> for more information. The developer must take their state into consideration and reduce app activity accordingly:</p>
<ul>
<li>When your app enters the thumbnail state, it should stop any extraneous processing and use only the resources it needs to update the cover or maintain critical functionality like maintain a server connection or check a remote server for updates. Your app should stop other threads that aren&#8217;t required when running in the background. Examples of what to stop are rendering, multimedia playback, audio playback, etc.</li>
<li>The invisible signal is emitted when the app (and its thumbnail) is no longer visible. This state might occur if the device backlight is off or if another app has been brought to the foreground. When your app is in this state and doesn&#8217;t have the run_when_backgrounded permission, it is considered stopped and won&#8217;t receive any processing time. If your app does have the run_when_backgrounded permission, your app should stop any rendering operations (for example, updating the UI) and any other unnecessary operations. Your app should only listen for events that it needs to respond to, and process these events when they occur.</li>
<li>It is very important for applications to reduce processing as much as possible while thumbnailed or invisible. It will conserve CPU usage and also save on battery life. This is an important criterion that is taken into consideration when applications are evaluated during the BlackBerry World approval process.</li>
</ul>
</li>
<li>When a user closes your app, your app usually needs to perform some final cleanup operations, whether it be saving the user&#8217;s data, shutting down your threads in a particular way, or manually closing the app database or network connections. Cascades provides developers with a choice of automatic or manual exit mechanisms that they can take advantage depending on their cleanup needs.</li>
<li>BlackBerry OS developers should be aware of the fact that C++ does not have automatic garbage collection like Java does. However, Qt does provide some built-in mechanisms that provide limited object cleanup. Please refer to the API references for QObject and other QtCore classes like QSharedPointer for additional information on how to manage pointers and automatically delete objects after use. For more information about object ownership in C++ and QML and what that entails, go to <a href="https://developer.blackberry.com/cascades/documentation/dev/fundamentals/index.html" target="_new"><br />
https://developer.blackberry.com/cascades/documentation/dev/fundamentals/index.html<br />
</a></li>
<li>The new pooled state is designed to take advantage of the extra memory added to BlackBerry 10 devices. The system sends a signal to the app to prepare to be pooled. The app is expected to reset its UI t o a point that matches startup conditions and signal back that the operation is completed. If the app fails to do this, the app will be terminated.</li>
<li>Another limitation to be aware of is that currently only eight apps can run at the same time on BlackBerry 10. As a best practice, developers should ensure that any apps launched in the background to process push events should exit as soon as possible if user interaction is not required or if they launch a notification to alert the user to launch the app later. This will prevent push interactions from bumping up the number of running apps for more than a short period of time.</li>
</ol>
<p>Please stay tuned for series Part 3 – UI Overview.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/13902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/13902/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13902&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/02/java-to-cascades-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/5c7714acaeda7a566baa9545c280c91c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pratiks1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/02/applifecycle.jpg?w=450" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/02/applife.png" medium="image">
			<media:title type="html">AppLife</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 1: Introduction</title>
		<link>http://devblog.blackberry.com/2013/01/port-java-to-cascades-part-1/</link>
		<comments>http://devblog.blackberry.com/2013/01/port-java-to-cascades-part-1/#comments</comments>
		<pubDate>Thu, 31 Jan 2013 17:07:38 +0000</pubDate>
		<dc:creator>Gurtej S.</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[app porting]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[port app to BlackBerry 10]]></category>
		<category><![CDATA[porting]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=13401</guid>
		<description><![CDATA[With all the excitement around BlackBerry 10 launch, one key request from our developer community is how to bring your existing BlackBerry Java applications to BlackBerry 10. As always, we at RIM developer relations constantly strive to break any barriers for developers. Starting today, we will be publishing a series of blog posts specifically designed [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13401&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-13402" alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2013/01/bb10-porting.jpg?w=557&#038;h=408" width="557" height="408" /></p>
<p>With all the excitement around BlackBerry 10 launch, one key request from our developer community is how to bring your existing BlackBerry Java applications to BlackBerry 10. As always, we at RIM developer relations constantly strive to break any barriers for developers.</p>
<p>Starting today, we will be publishing a series of blog posts specifically designed to help port your existing BlackBerry Java application to BlackBerry 10. As you may already be aware, BlackBerry Java is no longer supported on BlackBerry 10. Our goal here is to provide you all the info needed to quickly migrate your app functionality.</p>
<p>The BlackBerry 10 Native SDK enables you to develop applications in C/C++ and provides an open-source friendly environment for porting POSIX compliant code. It comes with the Cascades framework allowing you to build visually rich applications. The key focus of this development guide is specifically on BlackBerry 10 Cascades development. For more information on BlackBerry Native Development, please refer to <a href="http://developer.blackberry.com/native/" target="_new"><br />
http://developer.blackberry.com/native/<br />
</a></p>
<p><span id="more-13401"></span></p>
<p><img class="aligncenter size-full wp-image-13403" alt="cascades-porting-2" src="http://rimdevblog.files.wordpress.com/2013/01/cascades-porting-2.jpg?w=600&#038;h=265" width="600" height="265" /></p>
<h3><strong>What is Cascades?</strong></h3>
<p>BlackBerry Cascades is built using the Qt framework, which allows Cascades to leverage the Qt object model, event model and threading model. BlackBerry Cascades enables you to develop your UI in C++, Qt Modeling Language (QML), or both. Qt Modeling Language (QML) is a declarative language that&#8217;s based on JavaScript and is included as part of Qt. You can use QML to describe the structure and behavior of a set of UI controls. BlackBerry Cascades uses a modified version of QML to let you create UIs for your apps.</p>
<p>One fundamental importance when looking to develop your BlackBerry Cascades application is deciding when to use QML or C++. You can use both of these languages in your application, but as a general rule of thumb you should use QML for your UI development and C++ for your business logic. Please refer to the below link more information on BlackBerry Cascades development and to download Native SDK and BlackBerry 10 Simulator. <a href="https://developer.blackberry.com/cascades/" target="_new"><br />
https://developer.blackberry.com/cascades/<br />
</a></p>
<h3><strong>API Feature Parity</strong></h3>
<p>One of the main challenges while migrating app functionality from BlackBerry Java to Cascades is finding the correct mapping of APIs. To simplify this process, below is an API Feature Parity table that covers the most common BlackBerry Java APIs and their corresponding equivalent API in Cascades.</p>
<p><img class="aligncenter size-full wp-image-13412" alt="cascades-table" src="http://rimdevblog.files.wordpress.com/2013/01/cascades-table1.jpg?w=593&#038;h=959" width="593" height="959" /></p>
<p>As you can see from the above table image, most of the common Java APIs have a direct mapping in Cascades making it easy for you to port your existing BlackBerry Java application to BlackBerry 10.</p>
<p>Please stay tuned for series Part 2 – Application Life Cycle.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/13401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/13401/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=13401&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/01/port-java-to-cascades-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/41e8b1a2189dfce0a51887beab21795d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gurtejsan1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/01/bb10-porting.jpg" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/01/cascades-porting-2.jpg" medium="image">
			<media:title type="html">cascades-porting-2</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/01/cascades-table1.jpg" medium="image">
			<media:title type="html">cascades-table</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry Java Plug-in for Eclipse now available on Github!</title>
		<link>http://devblog.blackberry.com/2012/09/blackberry-java-eclipse-plugin-github/</link>
		<comments>http://devblog.blackberry.com/2012/09/blackberry-java-eclipse-plugin-github/#comments</comments>
		<pubDate>Wed, 26 Sep 2012 16:29:01 +0000</pubDate>
		<dc:creator>Matt W</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[BlackBerry Java Plug-in for Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[plug-in]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=11221</guid>
		<description><![CDATA[Calling all Java® developers: We have some news regarding the BlackBerry® Java® Plug-in for Eclipse™! We are pleased to announce a new Open Source project for the BlackBerry development platform. While we have stopped SDK work on BlackBerry® 7 OS, we’ve decided to make the source code open for all those developers using the Java [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=11221&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-11222" title="" src="http://rimdevblog.files.wordpress.com/2012/09/java-logo.jpg?w=230&#038;h=227" alt="" width="230" height="227" /></p>
<p>Calling all <a href="https://developer.blackberry.com/java/" target="_new">Java® developers</a>: We have some news regarding the BlackBerry® Java® Plug-in for Eclipse™!</p>
<p>We are pleased to announce a <a href="https://github.com/blackberry/Eclipse-JDE" target="_new">new Open Source project</a> for the BlackBerry development platform. While we have stopped SDK work on BlackBerry® 7 OS, we’ve decided to make the source code open for all those developers using the Java Plug-in for Eclipse. The BlackBerry Java Plug-in for Eclipse is now available as a repository provided under the Eclipse Public Licenses 1.0. The BlackBerry Java Plug-in for Eclipse lets you develop, test, and debug BlackBerry Java applications using the Eclipse IDE, in combination with the BlackBerry SDK appropriate for the BlackBerry OS your application is targeting.</p>
<p>The readme file on the project page details all the information you will need to build the source code for Windows or Mac, build your own update site for the plug-in or even build your own full installer. For all the details, jump to the <a href="https://github.com/blackberry/Eclipse-JDE" target="_new">project page</a>.</p>
<p>Additionally, the BlackBerry Java Plug-in for Eclipse 2.0 is now available for <a href="https://developer.blackberry.com/java/download/eclipse" target="_new">download</a> as a complete install for Windows and Mac, or as an update via our Eclipse update sites. For more BlackBerry Java related information, tool downloads, sample apps and documentations, please visit our <a href="https://developer.blackberry.com/java/download/eclipse" target="_new">Java development page</a> &#8212; and make sure to <a href="https://github.com/blackberry/Eclipse-JDE" target="_new">fork us on Github</a>!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/11221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/11221/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=11221&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/09/blackberry-java-eclipse-plugin-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/24f0db511856433f3357906c9dfd7476?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mwhiteman</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/java-logo.jpg" medium="image" />
	</item>
		<item>
		<title>Developing in Cascades</title>
		<link>http://devblog.blackberry.com/2012/07/cascades-development/</link>
		<comments>http://devblog.blackberry.com/2012/07/cascades-development/#comments</comments>
		<pubDate>Wed, 18 Jul 2012 14:37:47 +0000</pubDate>
		<dc:creator>Shadid</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Editorials]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=10277</guid>
		<description><![CDATA[Examining some of the highlights of developing for the BlackBerry platform using Cascades.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10277&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><em>Jamie Julius is the Chief Software Architect of <a href="http://appworld.blackberry.com/webstore/vendor/13">Nobex Technologies Inc</a>. – Ed.</em></p>
<p style="text-align:center;"><a href="http://rimdevblog.files.wordpress.com/2012/07/img_00000030.png"><img class="aligncenter  wp-image-10282" title="IMG_00000030" src="http://rimdevblog.files.wordpress.com/2012/07/img_00000030.png?w=491&#038;h=819" alt="TITLE_IMAGE" width="491" height="819" /></a></p>
<p>About a month ago, I took the plunge and started a Cascades™ project for BlackBerry® 10.</p>
<p>Initially I was in a state of shock. This is an entirely different world compared to legacy BlackBerry Java® development – including the language (C++), the framework (Qt/Cascades), and a declarative language to build the UI (QML). Slowly and surely things started coming together. Fortunately, I had done a lot of C++ programming in my distant past, and somewhere in the back of my brain most of that old knowledge was still there. Nonetheless, I found myself staring at compiler error messages in bewilderment when I attempted to make a static function member call using dot syntax (Java) instead of using :: (C++).</p>
<p>After a couple of days the state of shock wore off and I found myself getting excited about this new way of writing BlackBerry applications. So what’s so great?</p>
<p>RIM® has been spotlighting Cascades with its cool controls and animation as a great framework for a new generation of apps. This is all true, but to me, what really makes the difference is the Qt foundation on which Cascades is built. It is Qt that enables rapid and solid development with a clean separation of the UI from the code behind.</p>
<p>In an attempt to summarize what I like about Qt, here’s a short list of the things that have made me smile so far. No doubt as I progress, the list will grow.</p>
<p><span id="more-10277"></span></p>
<h3><strong>QML</strong></h3>
<p>Defining a UI via markup is more intuitive than defining it via code. The markup clearly expresses the hierarchical structure of the UI. Such a hierarchy is almost impossible to see when looking at the equivalent in code. Furthermore, the structure can be expressed with minimal lines of markup in contrast to hundreds of lines of code without any loss of functionality. Needless to say, tweaking the UI and finding and fixing bugs via markup are all a breeze. QML also supports components. This means that I can define QML fragments in separate files and refer to these components from other QML files. I have already found myself defining re-usable pieces of QML. Of course, QML isn’t the only markup language in use today for writing non-HTML applications (e.g., XAML), so it’s great to see this “tried and proven” concept come to the world of BlackBerry development.</p>
<h3><strong>Code Behind</strong></h3>
<p>QML wouldn’t be very useful if it didn’t connect well with C++ code. Qt’s support for named properties and invocable methods in C++ makes it really easy to put code behind the UI. The UI can easily be configured to read values from a C++ object exposed via “properties”. In fact, when configured as such, a control’s property is “bound” to an object’s property. This means that as the value of the object’s property changes, the UI automatically updates to reflect these changes. C++ objects can also expose “methods” which can be invoked directly from QML.</p>
<h3><strong>Qt Threading</strong></h3>
<p>Qt expands on the basic notion of a thread by providing a built-in event loop for any thread. Qt allows an object to be “associated” with a thread. Via dynamic method invocation, a method can be invoked on an object associated with another thread. When such invoked, Qt transparently wraps the method invocation in an event and places it in the appropriate thread’s event queue. As such, the method will be ultimately invoked on the object’s thread. I found this to be extremely helpful when dealing with a particular object type, containing long-running methods. If used correctly, one can use this technique to gain the benefits of multi-threading without the dangers of concurrency.</p>
<h3><strong>Signals and Slots</strong></h3>
<p>Qt uses a mechanism known as signals and slots to allow objects to “listen” to events triggered by other objects. I have found this mechanism to be much more flexible than the Java listener paradigm (i.e., implementing interfaces). Any object can be eligible to listen to “signals” of any other object, simply by implementing a method “slot” with the correct signature. Needless to say, should the receiving object be associated with a different thread, the invocation of the “slot” will be invoked on the object’s thread.</p>
<h3><strong>Maturity and Community Support</strong></h3>
<p>Qt is not new. That’s good! It’s good because it means that it is stable and mature. It means that it contains hundreds of classes providing everything from a basic string wrapper (QString) to XML processing (QDomDocument). It is also very well documented. Both officially on the Qt site and unofficially by the zillions of posts on various forums.</p>
<p>In short, I’m enjoying the ride. Qt is a great foundation for writing apps. Coupled with Cascades, I can definitely say that we have a strong framework for building the next generation of BlackBerry apps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/10277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/10277/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10277&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/07/cascades-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/25ee80c29143f159bad70d24df820bc1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">shadidhaque</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/07/img_00000030.png?w=614" medium="image">
			<media:title type="html">IMG_00000030</media:title>
		</media:content>
	</item>
		<item>
		<title>Best Practices for Internationalizing your BlackBerry WebWorks App</title>
		<link>http://devblog.blackberry.com/2012/06/internationalizing-webworks-app/</link>
		<comments>http://devblog.blackberry.com/2012/06/internationalizing-webworks-app/#comments</comments>
		<pubDate>Mon, 18 Jun 2012 14:09:53 +0000</pubDate>
		<dc:creator>Naveen</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[blackberry webworks]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[sample code]]></category>
		<category><![CDATA[texts]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=9764</guid>
		<description><![CDATA[Demonstrating the best ways to internationalize your BlackBerry WebWorks application.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9764&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:center;"><img class="aligncenter size-full wp-image-9769" src="http://rimdevblog.files.wordpress.com/2012/06/webworks.jpg?w=550&#038;h=255" alt="TITLE_IMAGE" width="550" height="255" /></p>
<p>Last month, we looked at <a href="http://devblog.blackberry.com/2012/05/app-internationalization" target="_new">how to internationalize your BlackBerry® Java® application</a>. In this post, we will look at how to internationalize your BlackBerry® WebWorks™ application. There are a few options for accomplishing this – let’s take a look.</p>
<h3><strong>Using JavaScript and storing all the texts locally</strong></h3>
<p>One common way to internationalize your web application is to remove all strings from your code and have them all in an object with key-value pairs. All the code exists locally and nothings get stored on the server side.</p>
<p>This looks something like:</p>
<pre>var strings = {
	"en" : {
		"BUTTON_CANCEL" : "Cancel",
		"BUTTON_SAVE" : "Save"
	},
	nl: {
		"BUTTON_CANCEL" : "Annuleer",
		"BUTTON_SAVE" : "Opslaan"
	}
}</pre>
<p>Now let&#8217;s assume you keep the chosen language somewhere in a variable called language. You can then access the right string for the user language, like with the cancel button text for example:</p>
<p>Strings[language].BUTTON_CANCEL</p>
<p>That will give you either &#8216;Cancel&#8217; or &#8216;Annuleer&#8217; depending on whether the language variable contains &#8216;en&#8217; or &#8216;nl&#8217;.</p>
<p><span id="more-9764"></span></p>
<h3><strong>Using JavaScript and storing all the texts on a remote server</strong></h3>
<p>Another way of internationalizing your application in BlackBerry WebWorks platform is to use the server side code. Unfortunately, JavaScript does not have the concept of a resource file, and strings that will be generated by JavaScript must be defined in the code.</p>
<p>The easiest approach to deal with this issue is to define your JavaScript strings dynamically in server-side code (Java/JSP, ASPX, PHP, etc.). The following example defines some string resources in a JavaScript script block at the top of a JSP page:</p>
<p><img class="alignnone size-full wp-image-9768" title="" src="http://rimdevblog.files.wordpress.com/2012/06/webworks-1.jpg?w=600&#038;h=142" alt="" width="600" height="142" /></p>
<p>Assuming the currentLocale object is set to English (US), the resulting block should look like this:</p>
<p><img class="alignnone size-full wp-image-9767" title="" src="http://rimdevblog.files.wordpress.com/2012/06/webworks-2.jpg?w=600&#038;h=216" alt="" width="600" height="216" /></p>
<p>When currentLocale is set to German (Germany) it should change to this:</p>
<p><img class="alignnone size-full wp-image-9766" title="" src="http://rimdevblog.files.wordpress.com/2012/06/webworks-3.jpg?w=600&#038;h=195" alt="" width="600" height="195" /></p>
<p>There are a couple things to keep in mind with this approach. First, any strings that are embedded in the files, whether JSP/ASPX/PHP/etc. or JavaScript .js files, must be externalized, i.e. the strings should be moved into the string resource block as demonstrated above, and replaced in the code with their variable names. Second, the JavaScript string resource block should be defined before any other embedded blocks or .js file includes that make use of these externalized strings. For example, the resource block should be defined before the following function is called:</p>
<p><img class="alignnone size-full wp-image-9765" title="" src="http://rimdevblog.files.wordpress.com/2012/06/webworks-4.jpg?w=500&#038;h=272" alt="" width="500" height="272" /></p>
<h3><strong>Using JavaScript Object Notation (JSON)</strong></h3>
<p>Finally, another way to add multi-language support to your BlackBerry WebWorks application is to use JSON objects. Here is a sample which illustrates the use of JSON objects and changes the text dynamically based on the user’s language selection:</p>
<pre>&lt;html&gt;
&lt;body&gt;
&lt;h2&gt;Internationalization Sample in WebWorks&lt;/h2&gt;
&lt;h3&gt;Select a language:&lt;/h3&gt;
&lt;p&gt;

&lt;select id="languagechoice" onChange="displayGreeting()" &gt;
  &lt;option value="1"&gt;English&lt;/option&gt;
  &lt;option value="2"&gt;French&lt;/option&gt;
  &lt;option value="3"&gt;Spanish&lt;/option&gt;
  &lt;option value="4"&gt;German&lt;/option&gt;
&lt;/select&gt;

&lt;br/&gt; 
&lt;br/&gt;
&lt;br/&gt;

 &lt;span id="greetings"&gt;&lt;/span&gt; &lt;br/&gt;
&lt;/p&gt;

&lt;script type="text/javascript"&gt;

function displayGreeting(){

 var lang = document.getElementById("languagechoice");
 var lang_value = lang.options[lang.selectedIndex].value; 

 var JSONObject_en = {"hello":"Hello, Welcome to Internalization of WebWorks Applications in English!"};
 var JSONObject_fr = {"hello":"Hello, Welcome to Internalization of WebWorks Applications in French!"};
 var JSONObject_es = {"hello":"Hello, Welcome to Internalization of WebWorks Applications in Spanish!"};
 var JSONObject_de = {"hello":"Hello, Welcome to Internalization of WebWorks Applications in German!"};

 if(lang_value == 1){
   document.getElementById("greetings").innerHTML=JSONObject_en.hello 
 }
 else if (lang_value == 2 ){
   document.getElementById("greetings").innerHTML=JSONObject_fr.hello
 }
 else if (lang_value == 3 ){
   document.getElementById("greetings").innerHTML=JSONObject_es.hello
 }
 else{
   document.getElementById("greetings").innerHTML=JSONObject_de   .hello
 }
}

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/9764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/9764/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9764&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/06/internationalizing-webworks-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/83a3304d7f99cd7e5d2323b7338f7305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">naveenm1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/webworks.jpg" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/webworks-1.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/webworks-2.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/webworks-3.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/webworks-4.jpg" medium="image" />
	</item>
		<item>
		<title>Be Social – Integrate your apps with Facebook and Twitter</title>
		<link>http://devblog.blackberry.com/2012/06/integrate-apps-with-social/</link>
		<comments>http://devblog.blackberry.com/2012/06/integrate-apps-with-social/#comments</comments>
		<pubDate>Wed, 06 Jun 2012 13:33:03 +0000</pubDate>
		<dc:creator>Shadid</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[BlackBerry 7]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sample app]]></category>
		<category><![CDATA[social networks]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=9669</guid>
		<description><![CDATA[Find out how to integrate your app with social networks like Facebook and Twitter.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9669&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the unsung heroes of <a href="http://www.blackberry.com/bb7" target="_new">BlackBerry® 7</a> Java SDK is the Send Command Framework. Although the name doesn’t say much, this API lets you seamlessly integrate with existing apps on the device to share data. Thankfully the native <a href="http://appworld.blackberry.com/webstore/content/680/?lang=en" target="_new">Facebook®</a> and <a href="http://appworld.blackberry.com/webstore/content/8160/?lang=en" target="_new">Twitter®</a> apps are two of many!</p>
<p style="text-align:center;"><img src="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-2.jpg?w=270&#038;h=360" alt="TITLE_IMAGE" width="270" height="360" /> <img title="" src="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-3.jpg?w=270" alt="" width="270" /></p>
<p style="text-align:center;"><em><a href="https://github.com/blackberry/Samples-for-Java/tree/master/SocialApp" target="_new">Download the sample app</a></em></p>
<p>So this is it folks &#8212; no more hair-pulling to figure out how to talk to social networks directly. There are already apps for them, so let’s learn how to leverage those apps from ours instead of reinventing it.</p>
<p><span id="more-9669"></span></p>
<p>The first step is to create the data or context we would like to share. This context is simply a JSON object that encapsulates our data. Here is an example:</p>
<p><code>JSONObject context = new JSONObject();<br />
try {<br />
context.put(SendCommandContextKeys.TEXT, "Your Text");<br />
context.put(SendCommandContextKeys.SUBJECT, "Your Text");<br />
// context.put(SendCommandContextKeys.PATH, "file:///.....");<br />
} catch (JSONException e) {<br />
System.out.println(e.toString());<br />
}</code></p>
<p>I intentionally commented out the PATH type data because we cannot use PATH data in a context that also has TEXT or SUBJECT types. But I still wanted to highlight that we can also share a file path (e.g. a photo).</p>
<p>Once we have our data context nicely wrapped up in a JSONObject, we need to create SendCommand objects that point to specific apps with a specific context. So how do we get these SendCommands? Easy peasy &#8212; we simply query the Send Command Framework with our context data. Here’s how:</p>
<p><code>SendCommand[] commandsAll =<br />
SendCommandRepository.getInstance().get(SendCommand.TYPE_TEXT, context, true);</code></p>
<p>Notice that the 3rd parameter above is a Boolean. If true, the query returns all commands regardless if their associated applications can be opened; if false, it returns only commands whose associated applications can be opened. Ideally we would set it to false; however, in this post we will see how we can get them all and filter them in our own application logic.</p>
<p>Each SendCommand object has an ID that uniquely identifies the target app and the context. Note that the IDs are not documented as there could be so many of them, but it is fairly easy to figure them out by experimentation. Since our target is the Facebook app and the Twitter app, let me save you the work by telling you what their IDs are.</p>
<p><img class="aligncenter size-full wp-image-9672" title="" src="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-1.jpg?w=550&#038;h=130" alt="" width="550" height="130" /></p>
<p>Now let’s filter:</p>
<p><code>for (int i = 0; i &lt; commandsAll.length; i++) {<br />
if (commandsAll[i].getId().equals("Twitter_text")) {<br />
commands[0] = commandsAll[i];<br />
}<br />
if (commandsAll[i].getId().equals("Facebook_text")) {<br />
commands[1] = commandsAll[i];<br />
}<br />
}</code></p>
<p>&#8230;and we are done. We have our SendCommand objects and we are free to call their run() method anywhere in our app. Be it a Button click or a Menu selection, knock yourself out!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/9669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/9669/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9669&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/06/integrate-apps-with-social/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/25ee80c29143f159bad70d24df820bc1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">shadidhaque</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-2.jpg" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-3.jpg" medium="image" />

		<media:content url="http://rimdevblog.files.wordpress.com/2012/05/connected-apps-1.jpg" medium="image" />
	</item>
	</channel>
</rss>
