Sibling CODs – or How to Make Your App Install Over The Air

It’s been way too long since I wrote a post – interesting aside for bloggers: don’t get out of the rhythm, it’s incredibly hard to start back up again once it’s no longer part of your daily routine. Anyway, I’ve been busy (more on that later) but due to demand am now committed to start posting again, and it was a recent comment on an earlier post that gave me the idea for this one: short but sweet and valuable to all aspiring BlackBerry app developers.

Big CODs

BlackBerry applications are compiled using the RAPC tool (which is called automatically by the JDE or the JDE Plug-in for Eclipse) into .cod files (pronounced like the fish by most developers). A .cod is basically a .jar file, which is further compressed, optionally signed, and has any unused code removed. They’re only usable by the BlackBerry – no other J2ME devices.

Because of some deep technical reasons (I think to do with the way the flash file system used to work on the device) a .cod file can only be a certain size. Or more correctly, a .cod file can only have a certain amount of code or static data (resources mostly). That limit is about 64k – so theorietically a .cod file could be almost twice that limit, with 64k each of code and data, but in practice that never happens, and in fact there seems to be another limit. In any case, the exact number isn’t all that important – the point is that most modern applications have no trouble breaking through either or both of those size barriers.

So what happens when you make an application that produces a .cod that’s too big? The RAPC compiler breaks the .cod into smaller .cod files, and renames them based on your initial .cod file. So instead of having:

File Size
myapp.cod 552,966

You get something like:

File Size
myapp.cod 58,016
myapp-1.cod 56,380
myapp-2.cod 57,980
myapp-3.cod 55,528
myapp-4.cod 53,816
myapp-5.cod 52,968
myapp-6.cod 50,004
myapp-7.cod 57,252
myapp-8.cod 53,772
myapp-9.cod 56,224

Or at least – that would make sense. Actually it’s something slightly different.

Sibling COD files

In reality what you get is:

File Size
myapp.cod 552,966

So what gives? Well if we take a closer look at that big cod file, what you’ll notice is this: it’s actually a .http://winrar.comzip file! That’s right, – rename it to and open it and inside you’ll see:

File Size
myapp.cod 58,016
myapp-1.cod 56,380
myapp-2.cod 57,980
myapp-3.cod 55,528
myapp-4.cod 53,816
myapp-5.cod 52,968
myapp-6.cod 50,004
myapp-7.cod 57,252
myapp-8.cod 53,772
myapp-9.cod 56,224

Those similarly-named files inside the big .cod/.zip file are called sibling COD files.

So What?

So, ok all your .cod files are packaged up into a .zip. Sensible, right? Just load that one file and everything works. Well, that’s true, except if your trying to download your app to your BlackBerry without using a BES. Understand that sentence – you can load one big .cod file if you’re doing it through the desktop manager, or if you’re downloading through a BES, but if you’re not attached to a BES and want to download it directly to your device, you’re out of luck.

Fortunately the solution is relatively simple – just unzip that big .cod/.zip and post all the individual files to the same directory, along with the .jad file. Then things will work fine – the browser will even know enough to show the user the total app size before downloading.

In fact, if you want to automate all that, I recommend the excellent (and free) bb-ant-tools, which includes a nice Ant task called jadtool that does the unzipping of the sibling cods for you.

So there you go – sibling CODs!

Eclipse tricks for BlackBerry developers 1 – type less, autocomplete more

If you’re a BlackBerry developer used to using the JDE (or – yes, I’ve seen this – the Visual Studio editor and Ant scripts – don’t ask, and no it wasn’t the BlackBerry Visual Studio plugin) then you might be wondering what the fuss is about switching to Eclipse. After all, there are still some problems that the Eclipse plugin has that aren’t there in the JDE.

Well, the main way you’ll gain productivity (and lose stress) is through Eclipse’s Java editor. Even those of you who are used to Visual Studio may be surprised by all that Eclipse has to offer. There are so many things to talk about, that in the interests of keeping this post short, I’ll focus on just one (but it’s a good one): Autocomplete


The keystroke for autocomplete is CTRL+Space, which will autocomplete whatever you’re working on, or give you a list of options if there are more than one. So a simple example – start typing:


Then press CTRL+Space


Notice you get a list of possible objects you might have been referring to – this will include, depending on context, classes, member variables, local variables, or methods (static and/or instance depending on where you’re typing).

Not bad so far – but there are similar things in other editors. Even the JDE has a limited version of autocomplete. Ok, here’s what else it can do:

Context sensitive autocompletion

If you type something like int a = <ctrl+space>, Eclipse will sort the autocomplete choices only to things that make sense on the right side – int variables (local, instance, static), or methods that return an int!

Automatic imports

Dislike managing Java imports? Autocomplete does that too – if you type in the name of a class (or partial name) and press CTRL+Space, the import for that class (if needed) will automatically be added to the top of your source file. I haven’t typed in an import statement myself in months. When you do autocomplete, Eclipse searches through all referenced libraries for your project, and since BlackBerry Eclipse projects include the RIM APIs, you get all of them…

Autocomplete Templates

Enough yet? Well, here’s another trick. Eclipse includes autocomplete templates – this is something that’s better experienced than explained, but I’ll give an example.

Type for and press CTRL+Space and you’ll see:


Now selecting one of those templates will let you fill in the details interactively:


Not all the templates apply to BlackBerry, as J2ME is missing some of its big brother’s features. You can see a full list under Window->Preferences->Java->Editor->Templates, but other useful ones are sysout -> System.out.println(the best beard trimmer), and instanceof -> instanceof test and conditional cast


Yep, even more clever tricks…

Type a class name and hit autocomplete (or autocomplete the class name and hit autocomplete again) and Eclipse will guess at a variable name for it:


Note there is no variable (instance or local) named mainScreen or screen in this class – those are Eclipse’s suggestions!

Autocomplete is also aware of camelCase methodNames, so if you type mainScreen.aMI, it’ll resolve down to mainScreen.addMenuItem,

There are some more tricks and subtleties – but start by making CTRL+Space your best friend in Eclipse and you’ll wonder how you ever lived without it. Sometimes it feels like a game to try and hit the fewest keystrokes – or maybe that’s just me. Anyway, that’s all for this post, but not by a long shot all there is to Eclipse. I’ll write about Refactoring, more auto-source code generation tricks, debugging and whatever else I can think of in future posts.


As soon as you get the hang of it, you may also need to shave the shaft. These can assist the blade glide. Before you start any shaving where you’re employing a beard trimmer, I never fail to advise warming up first. Even when you’re thinking about obtaining a particular body part waxed, don’t forget to provide everything a very good clipper, states Rayner. Since we’re trimming not shaving you will require some type of hair clipper. I strongly advise getting yourself a good body groomer should youn’t already have one.

Remember it isn’t a race! The sphere of traditional shaving is a fantastic location, full of exotic aromas and polished chrome. Manscaping can change your complete appearance and even make an impact on your sex life. With both of these tools you are going to be prepared to start your journey into manscaping!

Manscaping has existed for quite a long moment. But, more important, keep in mind that in regards to pubes, as with the majority of things, normal is malleable. If you’ve got a great full beard, you should read this article too. It’s still true that you have to be sure it stays clean so you don’t seem like a warrior. This how-to-manscape guide is going to teach you all you have to know as a way to get into manscaping.

After the base of the penis doesn’t have any hair it provides the illusion of an additional inch or two. You always need both of these areas matching and looking the exact same. That’s the area just over the principal attraction. These are your common trouble spots. It also provides a younger look and can be a turn on. A great way to assess the effects on the remainder of your body is to look at your face. This said it may make a significant impact on how you look and feel.

Don’t fret too much, though. After a few weeks of your new hair, however, you simply want your length back. Then shave the back employing no guard. Both exact important things to think about. And from a specialist, at that! The Undercarriage The critical stuff. It’s not anywhere near as traumatizing.

You ought to make certain you’re holding the skin taut in this specific instance, states Whitely. Even when you don’t manscape any other portion of your entire body, your back should remain smooth. Consider the regions of your body which you want to manscape. And the neck, if necessary, states Rayner.

Pick the right razor, it is likely that the one that you use on your face is simply fine, if you are not employing a single bladed razor for your manscaping requirements. Looking like a Yeti isn’t a hot appearance. This just makes the face appear fuller. This is particularly true should you not think you are going to be in a position to trim them neatly. It doesn’t have to be difficult. It seems average at best. Now’s the opportunity to determine if you’re likely to shave the pubic region.

If everything else fails, see a specialist. Plus it just general looks far better and will cause you to feel much better. You’re about to discover. You might be asking yourself. There are a number of matters you can do in order to manscape both your entire body and face and all them combined will force you to look very polished and well groomed. Nevertheless, it is now time to, since the phrase goes, suck this up. By a day later, he’d shaved.”

With a bevy of beard goods on the sector, you need to be able to chance upon a pre-shave oil you want. During the time you’re still in the shower you may get started manscaping your stomach. Manscaping is pretty simple to do with the correct equipment and tools so to speak.

The previous two are definitely the most expensive. Let’s consider some things before you begin shaving away here. To start with, women don’t need a guy that looks like he crawled from a cave. Every guy differs and nobody is the exception here. This is particularly true for athletic guys. I’m here in order to let you know, it’s actually wonderful.

In the end, the word receives an awful wrap, and I’m here to provide you with a heaping scoop of man-truth about manscaping and why you need to do it. Well the response is maybe. They’ll find the job finished.

Make up Artists

Painter David, Jacques-Louis David is among the most famed painters. If it’s necessary for you to have a tattoo done, visit a dependable artist. It’s likewise quite important to select the best type of pencils. If you are searching for a part of art for your decor, buying from an unaffiliated artist is a great option. Actually, each Face Disk set comprises detailed instructions for application, as well as a selection of complimentary goods like foundation, mascara and lip liner. Choosing which kind of makeup box is an issue of preference and convenience. Whether you would like your own private kit or intend to work as an expert makeup artist, you must take some time to intend and assemble a kit.

If you’ve ever visited an expert makeup artist, she’s going to tell you your eyebrows are the most significant feature on your face. Thus, an expert makeup artist ought to be carefully decided to be able to receive a stunning makeover. He knows about the various aspects that would have an effect on the appearance of the bride. The expert makeup artists also help you to save your precious moment. Many makeup artists also provide touch-ups as a piece of their expert services. It is possible to grow to be a skilled artist only as long as you practice and practice. Don’t copy other artists do the job.

Whenever you’re planning your wedding, bear in mind that you aren’t the only one getting married. If you are experiencing an outdoor wedding, make sure that you own a backup plan in the event of awful weather. An outdoor wedding has its very own all-natural beauty but you still need to check on the area wherever your wedding is going to be held right before the time that your wedding. The standard Igbo wedding in ethnic language is called igbankwu and it’s a lovely ceremony of conventional customs and pageantry. A very good thing for the bride to stay in mind in regards to weddings is to ensure you do excellent background checks on your makeup artist if indeed you’re hiring one. She looks beautiful and groom looks elegant.

The wedding day is the largest day of the groom and bride. Be ready to have a small fun and wonder around the internet seeking someone who you like and looks as though their work might be an excellent investment. For those that have passion, it isn’t just a job. Thus, it’s probable that there is going to be lots of jobs for the particularly talented comic book artist later on.

My hair is completed, my makeup’s completed,’ she purred. Not only should you are feeling confident about your hair and makeup before you begin shooting, it’s also wise to wear clothes you’re feeling good in and be sure you’re in shape so that you truly feel confident about your physique. After that it’s about the best drugstore foundation! After many decades, this exact same makeup has gotten very popular around the world, and you’re correct if you guessed this makeup is mineral makeup. Bridal makeup is just as significant as choosing a suitable life partner is. With the support of an expert makeup artist, an individual may have a great Bridal Makeup.  To make sure to’re purchasing the very best foundation makeup, the best way to color match starts with a colour that’s between that individual and throat color.

Pencil drawing is the fundamental thing you want to learn to be a fantastic drawing artist. Learn if the painting was varnished, or if you’re going to want to do it yourself. If you discover an outstanding reproduction painting, you will want to look after it the correct way. In the modern world, it is possible to find art anywhere. Understanding how to opt for a painting and what things to expect can help you make an educated choice. It’s a good consideration to have a Thomas Cole painting. It’s a lot cheaper than trying it out on canvas.

Fishing Hooks

You truly can’t fail with one of these hooks. Zoneloc hooks are the actual deal,” explained Yelas. It’s very good to understand what size hooks you will need for different lures. As a way to do this you will need large fishing hooks, like a size 10 or bigger.

Not all hooks are made equal and at times even very massive hooks are going to have smaller gap. Midge hooks were created for smaller flies, but they were also made for large fish. The midge hooks are moved to some other page. It’s important to be aware that modern hooks frequently have protective coatings on them to avoid rust. JRW gang hooks super fish catching hooks ought to be used anytime which you’re fishing with worms since they allow the worm to be shown in an outstretched and all-natural manner the manner nature and the fish which you are trying to catch are utilized to.

The hook hangs from the painting’s bottom. These hooks have a tendency to be more expensive, as they’re also made from high-quality materials like carbon steel. Since a treble hook includes 3 shanks with 3 points for impaling a fish, it raises the odds of hooking a fish. Thick wire fish hooks aren’t going to penetrate the challenging cartilage of a bass’ mouth in addition to a thinner wire hook.

If you’re not sure whether a hook is suitable for you, never wait to speak to us to be certain you get the most suitable item. Although hooks arrive in a number of shapes and styles, they also arrive in a tremendous scope of sizes. Eagle Claw hooks perform well through the board without costing too much, whether you’re trying to find a very simple worm hook for catching bass or a durable treble hook for most different kinds of baitfish.

You’ll need to coordinate with your hook to your species. The hook can subsequently be backed from the skin along the course of entry (Figure 2). You may lay the hooks beside the outlines to establish their size. Double fishing hooks are not that common hooks and they’re traditionally employed for catching Atlantic salmon. If you’re using barbless fishing hooks, as you need to do, taking away the hook is not going to be an issue and a typical disgorger is going to do the work perfectly. That fashion in which you can discover the proper hook, weight, bobber for most fishing scenarios.

For the Americans, fishing is regarded as their favourite past-time. Bottom fishing is an easy method that needs the most fundamental of tackle and equipment like the best fishing rod. Although, not everybody likes fishing, I really like it. Fishing is a typical recreational sport. Before beginning fishing, it is a very good idea for you to look at your state’s fishing requirements, just to be certain you have the appropriate documentations to fish. Whenever you’re perch fishing by means of a lure I would suggest by means of a wire trace whatsoever times, although perch don’t have a mouthful of sharp teeth.

Fishing is an enjoyable activity for the entire family. It is a great hobby and may look easy for the uninitiated, but if you don’t know what you’re doing, it may end up quite disastrous. Japanese tanago fishing utilizes a very brief rod only acceptable for quite a narrow array of environments where the fisherman can stand directly over the water.

Vent the fish as fast as you are able to. Fish are often lost by jumping back in the water within this vital portion of fishing. If you are fortunate enough to be in a position to fish employing a barbed hook, this method will really enhance your opportunities catching carp.

Government of India goes off the deep end with BlackBerry request

I’ve resisted too much comment about this, feeling that my specialty is really mobile development, rather than IT infrastructure and BlackBerry security, but the latest ’suggestion’from the government of India has pushed the whole BlackBerry security story from a sort of badly-managed PR problem for RIM into an absurd Orwellian/Gibsonian alternate reality.

The problem that UAE and Saudi Arabia (and now India) have had with BlackBerry email is that it’s too secure. Understandable, these are strong centralist regimes who like to regulate many aspects of their citizens’ lives. Now somewhere the press started reporting that the US Government actually has access to encrypted BlackBerry email, and other governments – such as India – started to say: “Hey, we want that too!”
There are at least 3 problems with this story:

Problem 1:

The US Government does not have the ability to spy on encrypted BlackBerry email.

First, look at this BlackBerry architecture diagram. BlackBerry is a very secure system, when used with a BlackBerry Enterprise Server (BES). The entire content of every packet exchanged between a BlackBerry device and its BES is encrypted with a symmetric key (usually AES, sometimes Triple DES) that’s only known to the device and the BES. Each device has a separate key. Keys can be created and exchanged entirely within the corporate firewall, without ever being sent over the public internet (there’s also an exchange mechanism using PKI – a method that’s widely used and secure even outside of BlackBerry) . Both AES and TDES are secure enough that the NIST has approved them for use by the US government in sending classified information. There are no known substantive attacks to AES. There are no known backdoors. Maybe the NSA or someone has discovered a way to crack AES, but that would mean the end of pretty much all digital security everywhere, and anyway if I had actual proof of that I probably wouldn’t be in a position to write this article.

Problem 2:

National Governments can already look at the encrypted packets sent and received from BlackBerry devices in their countries

Let me emphasize this first – I don’t mean that governments can see the content of packets: as I stated above, the content is encrypted, what I mean is that there’s a tiny bit of non-encrypted information that you can get even from an encrypted packet – information about where the packet came from and where it’s going. Check out that security diagram from RIMagain. Notice that while AES/TDES encryption applies to the whole path, there’s still a point where those (fully encrypted) packets flow from the wireless service provider’s infrastructure over the internet to the corporate BES. Actually there’s an additional hop through RIM’s infrastructure, but the point is: at some point those packets are flowing on internet infrastructure within your national borders!. You can look at them, do whatever you want with them (we know China has pretty much their entire vast country behind a firewall). It doesn’t matter that they have to go outside the country to get through RIM’s servers, they’re encrypted. RIM can’t read them anymore than anyone else can. In fact arguing that sending them through RIM’s servers is a security risk would be to argue the exact opposite of the ‘too secure’ problem (up is down, black is white?).

Five Things that BlackBerry does better than iPhone

I’ll start with a confession – I’ve been using an iPhone instead of a BlackBerry for the past little while, because my company has been focused on developing some iPhone products. The iPhone is a phenomenal device, and certainly has to have RIM worried, but having used both devices now, there are definitely a lot of things that the BlackBerry does way better. I’ve picked 5 things that I really really miss about using a BlackBerry (and probably they’ll be the reasons that I go back to BlackBerry for day-to-day use soon). I think most of these are known to most people, but I’ve omitted a few things that are commonly thought of as BlackBerry’s advantages – I’ll explain why at the end of the article.

1. Push Email

Yes, iPhone does push email too, but BlackBerry does it better. You can sync an Exchange account with your iPhone and get push email, but only one. I’ve always got a minimum of 2 accounts I want to keep up to date with – currently 5 – but even with 2, I’d have to choose a preferred one (or consolidate everything through one account, which isn’t an option).

And sure you can get 3rd party solutions for iPhone that use the push notification functionality to tell you about new email – I’m using one called Mail Notifier – but it’s not the same thing. I get notified of a new email, which includes a snippet of the text, but I then have to go into the Mail app, select the account, wait for it to connect and download, and then click the email. With BlackBerry the email is already there, and I can even set the device to pop the email client up on new emails. No going through the list of accounts, remembering which one the email came from, speaking of which…

2. Multiple Email Accounts

Handled beautifully by BlackBerry. I can view the inbox for each account separately, but never do. BlackBerry lets me view all emails from all accounts in one place, and keeps track so that when I reply it comes from the right account.

There’s more! I can have separate signatures for each account (really really irritating missing feature on iPhone), and when I compose a new email to a contact, the BlackBerry usually guesses correctly which account I want to send it from – probably based on some analysis of past correspondence.

With iPhone I have to click on mail, click on the account, click on inbox. And then back out through those screens to check my next account. Just enough extra clicks to be annoying, and I can’t see all my emails from all accounts at the same time.

Email is part of BlackBerry’s DNA – it’s initial killer app was email, and the business and devices were built around that, and it shows.

3. The Keyboard

While the iPhone’s virtual keyboard is a pretty phenomenal piece of engineering, and amazingly usable (more than I can say for BlackBerry’s attempt at the same thing – but that’s a post for another day), nothing on any mobile device has yet delivered the same instant easy usability that the physical BlackBerry keyboard has. Not much more to say than that, but I will add that I’ve noticed a change in my behavior with regards to email, and I think it’s largely because of the lack of keyboard on an iPhone:

The iPhone keyboard, even being slightly more difficult to use than BlackBerry’s real keyboard, has put enough of a barrier in place (at least in my head) that I reply to a lot less email, and so get a lot less done away from the desktop. Meaning my response time has gone down, and there’s always more email waiting for me to reply to when I do get to a desktop.

4. The notification light

Yes, this thing:


Amazingly simple, but I really miss it. I’m used to glancing down at my device to see if anything new had come in – or looking at it lying on a table. iPhone doesn’t have an LED indicator for new email, so I can’t do that. Again, email is part of the core DNA of BlackBerry, all the way down through the hardware, and this shows it.

5. Total integration – email, calendar, contacts, notes, tasks

This is probably a bunch of things, but I’ll put them all together here. BlackBerry just delivers a better experience when going between all the above applications. It syncs them more readily, makes it easier to link calendar entries to notes to tasks to contacts, etc. It’s difficult to quantify but the overall experience is just smoother – obviously this is based on years of development and user feedback from RIM. It’s core to the BlackBerry experience and they still do it better than iPhone (even with it’s super slick UI)

Runners Up

BlackBerry Messenger

Really great, and hugely popular, but I honestly never used it enough for it to make my personal top 5


The camera on my Curve 8900 blew away the iPhone (still does) but there are better mobile cameras out there than the best that BlackBerry or iPhone offer

Things I specifically left out


Yes, BlackBerry email (within a corporate environment) is very very secure. But for my use, I don’t really care. Most of my email is GMail based anyway, and so I’m always sending stuff to other people via plain unencrypted protocols. If I really care about security I send an encrypted attachment or use something other than email to do it.

Battery Life

I’ve gotten so used to plugging my devices in every night that this hasn’t been an issue with any mobile device (even though I use my iPhone for playing music as well as email/phone/etc). As long as the battery lasts the day, I’m happy.

Expandable memory

True, BlackBerry does support micro SD cards, but the support is hobbled by two things: 1. You can’t use the SD cards for app storage, and 2. for most devices at least, you have to remove the battery to remove the SD card – no hot-swapping

BlackBerry Arithmetic Performance

Playing with some animation for a new BlackBerry product (see next post) and wondering about performance of double/float/Fixed32 arithmetic I came across this post on Blurry Words, which is exactly what I was looking for.

Basically performance depends on the type of arithmetical operation you’re doing (though double is always slowest, usually by a wide margin). For addition and subtraction, Fixed32 is faster, for multiplication and division float wins out. Some sample results:

BlackBerry Bold

Variable Type Add/Sub (ms) Mult (ms) Div (ms)
Fixed32 153 597 776
float 317 242 550
double 514 366 1931
long 114 117 225
int 96 90 114
short 102 102 125
byte 104 107 127

The net.rim.device.api.math.Fixed32 class is interesting – I’ve mostly used it in scaling EncodedImages. It packs a fixed decimal representation of a number into a 32 bit int datatype, using the leftmost 16 bits for the whole part, and the rightmost 16 bits for the fractional part. This has the result that the normal + and – operators work as expected, but multiply and divide are handled through special functions.

Though I’ve gotta disagree with the poster’s conclusions – Fixed32 is not strictly legacy, it’s only been available since OS 4.0, at which time float and double were available on BlackBerry.

There’s a lot more interesting discussion and more results for different devices just in this post, so I encourage to read the original!

What would you like to know about BlackBerry development?

I’ve gotten several good ideas for posts from the readers of this blog, so I’ve decided (based on a user comment) to put a sticky post up solely for the purpose of soliciting new post ideas.

So here it is: What would you like to see me write about? Any area of BlackBerry development is fair game. Leave comments below and I’ll pick the ones that are most in demand or that I think would make the best posts.

I’ll start off with some ideas:

  • BlackBerry networking – TCP/BIS/BES – what are they and how do you use them?
  • Resource bundles and localization
  • Debugging with the Eclipse debugger
  • Debugging your application on a real BlackBerry using the Eclipse debugger (or the JDE debugger)



A suggestion on how to fix the BlackBerry JDE Eclipse Plugin

Big ones that I haven’t found good workarounds for include:
src is the only ‘officially’ recognized source folder. I don’t know why or how RIM overrode this, but the bug is: You can set any folder to a source folder (as with any Eclipse project) and things will work, until you shut down and restart Eclipse, at which point only src will still be a source folder. The workaround is to manually re-add your source folders to the build path each time you restart Eclipse (which may not be that often) which works, but is obviously not great (read: very, very annoying)
– you can’t add 3rd party .jar files to a BlackBerry project in Eclipse (mentioned here). The only way around this is to use source files (for KXML/KXML-RPC, the most common one I’ve seen, source is thankfully available, though you have to dig)
– importing from a .jdw (BlackBerry JDE Workspace) file is broken – you get a bunch of symbolic links to your files in your Eclipse project. Just means you have to rebuild your project, making the Import feature pretty useless.

There are others, but you get the idea

Don’t let these scare you away (unless one really is a showstopper) – Eclipse is still the best way to go.

Now, here’s my suggestion for fixing things:

Open source the BlackBerry JDE Plugin for Eclipse!

That’s right, open source it. Please. Listen, RIM, if your’e reading: There’s a big and growing community of BlackBerry developers yearning for a better way to build BlackBerry apps. And you have very strong competition in the form of iPhone and Android, both of which have stunning development environments. They both came to the game late, and they’ve leapfrogged you, and you’re falling further behind.

You don’t have to make it GPL or even LGPL. Something less idealistic would be fine. You don’t even have to open-source parts of the Plugin that we know work (like best fishing rods). Just as much as you can, as soon as you can, so some enterprising BlackBerry developer out there with good knowledge of the Eclipse platform (and believe me, there are enough) can figure out what’s wrong and FIX IT.

Custom Screen, Vertically Scrolling and more

There are two parts to my answer. To get scrolling behavior, just do what I did in my example screen. That is, create a MainScreen, create a GridLayoutManager, and then add the GridLayoutManager to the screen using the add(Field) method. When you add enough items to make the manager layout taller than the available screen height, scroll arrows will appear and the display will scroll to show the focused field. This works because MainScreen’s delegate manager is a VerticalFieldManager with scrolling enabled. What’s a delegate manager? That’s something you need to know if you ever make your own Screen.

Delegate Managers

Although Screen is a subclass of Manager, it actually doesn’t do any of the layout of fields added using its add (and insert) methods directly. Instead, each Screen delegates layout to a manager – the delegate manager. Notice that Screen’s constructor requires a Manager – you specify the Screen’s delegate manager at construction time, and can’t change it later. This means among other things that a MainScreen will always have a scrollable VerticalFieldManager as it’s main area – so if you want other behavior you can’t use MainScreen!

Easy enough – and this explains why we don’t need to do any additional work to the GridFieldManager example to make it scrollable – it’s automatically inside a vertically scrolling manager already! A couple more things about delegate managers, if you’re thinking of making your own screen.

First, the screen gets to set the position and size of its delegate manager. This is done in the layoutDelegate and setPositionDelegate methods. (You don’t have to make your delegate use the entire size of your screen).

Second, don’t worry about laying out any fields that are added to the Screen from within the Screen itself – that’s all done by the delegate. The screen deals with those field in the add (and insert) methods, and then basically forgets about them. This should be obvious but since it derives from Manager, I feel it’s worth saying explicitly – don’t make a Screen the same way you make a Manager.

Part Two: Mea Culpa

Part two will actually be quick – as the commenter pointed out, at some point GridFieldManager might end up setting fields to negative height. As we’ve just seen, in the case where we add it to a MainScreen, this isn’t an issue as we have a huge vertical space to play with. However it is a bug when we’re not in a vertically scrolling manager. So I made a couple of small changes to check that we don’t go above the available height. The interesting change is this, which is a fairly useful convention in a lot of layout methods – it ensures you respect the height (in this case) and width given by your manager: