EzDevInfo.com

blackberry interview questions

Top blackberry frequently asked interview questions

Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified

When I run my BlackBerry project in Eclipse, I get the following error:

Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified

How is this caused and how can I solve it?


Source: (StackOverflow)

How to customize a ListField in BlackBerry?

I want to customize a ListField in BlackBerry which would be able to list an image and text in a row.

How to accomplish this?


Source: (StackOverflow)

Advertisements

What is the best practise in blackberry development for reaching the widest range of smart phones?

I am wondering if anyone out there has experience writing application for blackberry smart phones. In particular, I am wondering how they get around the myriad permutations of model number/carrier and OS.

Is there a recommended approach on how to write your code so that it targets the widest range of smart phones?

Are there compiler switches that can be used to target code for particular model numbers?


Source: (StackOverflow)

please tell me when to use getInstance() method in java. [closed]

When to use the getInstance() method in java and what is the meaning of getInstance(null)?

locationProvider = LocationProvider.getInstance(null); 

can anyone tell me the meaning of the above line?


Source: (StackOverflow)

Blackberry - Loading/Wait screen with animation

Is there a way to show "Loading" screen with animation in blackberry?

Options:

  • PME animation content
  • multithreading + set of images + timer/counter
  • standard rim api
  • some other way

Any of this?

Thanks!


Source: (StackOverflow)

Blackberry Bold- Unable to recognize URLs and even custom patterns registered

We have a blackberry native app deployed on a BB Bold 9700 (OS Version: 5.0)

The app registers a custom pattern of the form string://[0-9]* . Strings matching the pattern get highlighted but the app does not receive the complete string

Also, with URLs recognized and highlighted, when launched, the BB browser receives only a partial string - http://

This bug is observed with BB Bold 9700 (OS Version: 5.0) only.

Couple of more questions

  1. Is there way to find all system patterns registered with a blackberry device?
  2. How does blackberry resolve conflict if a text is matched by more than one pattern?

in my case both texts "http://urlline" and "string://customtext" got clipped to "http:// and string" respectively.


Source: (StackOverflow)

java-me: Convert String to boolean

I'm developing for BlackBerry and I got stuck with this stupid problem:

I need to convert string values "1" and "0" to true and false, respectively. Nevertheless, Blackberry JDK is based in Java 1.3, so I can't use Boolean.parseBoolean, Boolean.valueOf or Boolean.getValue.

Obviously I can do something like:

if (str.equals("1")) return true;
else if (str.equals("0")) return false;

But this looks very ugly and maybe these string values could change to "true" and "false" later. So, Is there another way to convert between these types (String -> boolean, Java 1.3)?

UPDATED: all the answers of this question was very helpfully but I needed to mark one, so I selected Ishtar's answer.

Even so, my fix was a combination of multiple answers.


Source: (StackOverflow)

How can I change the background image of a field manager while focus change in BlackBerry Java

I'm a newbie to blackberry and creating menu with options. Each option contains a bitmap image and label.

This is the code for the first menu item:

hmf1_vfm1 = new VerticalFieldManager(Field.FIELD_HCENTER |          VErrticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.FIELD_HCENTER |   VerticalFieldManager.FOCUSABLE | Field.FOCUSABLE)
{
 boolean isFocus;
//Bitmap bmp1 = Bitmap.getBitmapResource("mnu_tile1.png");
protected void sublayout(int maxWidth, int maxHeight)
 {
super.sublayout(100,125);
setExtent(100,125);
 }

protected void paint(Graphics g) {
try
{
   //g.setBackgroundColor(0x504A4B);
   //g.drawBitmap(0, 0, bmp1.getWidth(), bmp1.getHeight(), bmp1, 0, 0);
                    g.clear();
    Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("mnu_tile1.png")); //mnu_tile1.png
                    this.setBackground(bg);
                    super.paint(g);
                }
                catch (IllegalArgumentException e) {
                    //SupportClass.showLog(TAG+" err 2 : "+e);
                }
            }

            protected void onFocus(int direction) {
                isFocus = true;
                super.onFocus(direction);
            }
            protected void onUnfocus() {
                isFocus = false;
                super.onUnfocus();
            }

            protected boolean navigationClick(int status, int time) {

                //SupportClass.showLog("New Order...navigationClick");
                return true;
            }
            public boolean isFocusable() {
                return true;
            }
            /*protected boolean touchEvent(net.rim.device.api.ui.TouchEvent message) {

                //SupportClass.showLog("New Order...touchEvent");
                return true;
            };*/
        };

The bitmap & label fields are added to this vfm. by the way as

BitmapField bfNO = new BitmapField(bmpNO,Field.FIELD_HCENTER | Field.FOCUSABLE)
        {
            protected boolean navigationClick(int status, int time) {
                SupportClass.showLog("bitmap...navigationClick");
                return true;
            }
            protected void paint(Graphics graphics) {
                //this.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.BLACK,0));
                super.paint(graphics);
            }
        };

LabelField txtNO = new LabelField("New Order",LabelField.FIELD_HCENTER | Field.FOCUSABLE )
        {
            protected void paint(Graphics g) {
                g.setColor(Color.WHITE);
                //g.setBackgroundColor(0x00000000);
                super.paint(g);
            }
            protected boolean navigationClick(int status, int time) {
                SupportClass.showLog("lable...navigationClick");
                return true;
            }
        };
  • I want to focus the vertical field manager which containing the image & label, while setting the background I can't see the background. I guess some layer is overlapped on the background.

  • Also I want to change the selector color of the fields (blue background) into transparent.

  • Please tell me what mistake I'm making.


Source: (StackOverflow)

Font Awesome Icons are not working in some browsers

I'm using Bootstrap + Font Awesome, and all is ok with most desktop and mobile browsers, but Font awesome icons are not working with some browser like opera Mobile, Opera Mini, and some version of Android Browser. Only displays a blank rectangle.

Does anyone know that problem? and , Is there a solution ?

Thanks

[EDIT 2013-03-06 !Important] I couldn't find any apparent problem, so I tried with unheard solutions. I tried with two online font conversion tools. First I used http://www.freefontconverter.com/ to convert the original FontAwesome svg to ttf. Then I used http://www.font2web.com/ to convert that .ttf to .eot, .woof anf .otf.

Results: opera mobile now displays icons properly. (I don't know whats are the changes, but works)

The problem now is Blackberry 6. I tested @font-face with a BB Curve 9300, Modernizr and Google fonts and all is ok. But FontAwesome still doesn't work...


[EDIT 2013-03-01] Opera mobile 10+ supports @font-face, so the problem may be another. I tried with another server font with @font-face and works ok, but with FontAwesome I can't show icons properly.

enter image description here

[EDIT 2013-03-03] The problem is not just with my website, Font Awesome website examples and tests are not working...

enter image description here

[EDIT 2013-03-4] I'm tried to make a fallback using Modernizr "font-face" feature detection, but opera Mobile and BlackBerry 6 return true because they supports that-feacture. How I can detect if FontAwesome font is loaded?


Source: (StackOverflow)

Convert from RSAPrivateCrtKeyParameters / RSAKeyParameters to PEM in J2ME

I'm developing some cryptography on BlackBerry, and we're working with certificates. We use BouncyCastle Lightweight API instead of RIM api to apply the cryptography, but in the lightweight API PEMWriter doesn't work (Well, it isn't included because it needs some JCE).

public RSAPrivateCrtKeyParameters _RSAPrivateKey;
public RSAKeyParameters _RSAPublicKey;

I get this keys from the object

AsymmetricCipherKeyPair theKeyPair

So, i need a method to BASE64Encode the two keys, or how to transform this keys to other objects that can be directly transformed to base64/PEM format. I can generate the certificate manually, but i need the encoding of the keys.

I know there are methods to do this, but all require PEMWriter or APIs that are not enabled with j2ME and the bouncycastle lightweight API.


Source: (StackOverflow)

Blackberry Push Implementation and waiting for acknowledgement

I already implemented the first 4 steps of the push initiator for blackberry

  1. Send a push request
  2. BlackBerry service returns a response
  3. BlackBerry service pushes data to an assigned, specific port on device
  4. Device returns response to BlackBerry service

Now I am working on the following two steps but nothing has happened yet:

5. BlackBerry service forwards acknowledgement to content provider

6. Read notification is returned to the BlackBerry service

Does anyone know how to implement that? I provided a domain when filling out the request but how do I achieve connection between me and the blackberry servers and how long do I have to wait for their response?


Source: (StackOverflow)

Blackberry User Interface Design - Customizable UI?

I am trying to design a Blackberry Application and I am wondering if there are any resources on how to create custom user interface elements, skin existing ones and what other possibilities are there?

I have developed a few iPhone applications with custom UI and stuff, so not sure what BB world offers in terms of UI development.

Any tips, suggestions or ideas would be great.


Source: (StackOverflow)

How can I easily unit test Blackberry code?

For my university class we are developing a multi-threaded Blackberry application which allows us to scan for other devices running our application with Bluetooth and then transfer files to each-other by TCP over the Wifi interface, implementing NAT traversal, all the while logging our GPS location. (It's a RIM sponsored Computer Networks class in case that wasn't obvious yet.)

I have grown fond of Test Driven Development and was going to employ it for developing my homework assignment. However, any Blackberry class which I extend or otherwise call during testing gives me a ClassFormatError due to illegal modifiers. I presume this error is caused because the jar with the Blackberry code must have been specially compiled for their proprietary JVM.

So far I've resorted to using the Proxy Pattern and implementing Mock Objects of the proxies. However, this is getting very tedious since I'm inheriting from many native Blackberry classes.

I would also like to avoid having to launch the Blackberry simulator if possible. It can take minutes just to boot it up and this is impractical and annoying for unit tests.

Is there am easy way to unit test my Blackberry code?


Source: (StackOverflow)

Best way to really grok Java-ME for a C# guy [closed]

I've recently started developing applications for the Blackberry. Consequently, I've had to jump to Java-ME and learn that and its associated tools. The syntax is easy, but I keep having issues with various gotchas and the environment.

For instance, something that surprised me and wasted a lot of time is absence of real properties on a class object (something I assumed all OOP languages had). There are many gotchas. I've been to various places where they compare Java syntax vs C#, but there don't seem to be any sites that tell of things to look out for when moving to Java.

The environment is a whole other issue all together. The Blackberry IDE is simply horrible. The look reminds me Borland C++ for Windows 3.1 - it's that outdated. Some of the other issues included spotty intellisense, weak debugging, etc... Blackberry does have a beta of the Eclipse plugin, but without debugging support, it's just an editor with fancy refactoring tools.

So, any advice on how to blend in to Java-ME?


Source: (StackOverflow)

Mobile development - Native VS Cross Platform VS JavaScript [closed]

Our company will soon start developing few products for mobile platforms, as CTO I was asked to examine the Pro and Cons of the different tools available in order to achieve the best quality / cost effective solution.

We will be aiming primarily at iOS and Android , secondary for Windows-Mobile and BlackBerry.

Candidates:

After conducting some background research, I found the following possible candidates:

  • Native - Simply but laboriously develop for each platform with its native tools and language.

  • HTML5, CSS and JavaScript - Could be a web service running on the device's browser (a website) , or an app which incapsulate such code around WebKit.

  • Rho mobile - Made by Google so it ought to be good - nevertheless based on Ruby (which we are not comfortable with) and does have a complex and rather flimsy dev environment.

  • PhoneGap - It seems easy and mostly based on Javascript - It is open source but lately acquired by adobe - (not a good sign)

  • Appcelerator - Anything from Javascript to PHP and to python, have a nice range of API Access but we heard many stories of rejection (by apple), and incompatibilities when using complex code across different platforms.

  • And more like MoSync, Sencha, Appmobi and Corona (didn't tested them first hand).

Some points of reference:

  • We are not planning on developing games, the applications we are planning to develop are in the realm of business applications & information tools.

  • The applications are not depending on excessive use of the devices API's (but do need some minor basic access)

  • The company already developed for iOS and we have a small team of native iOS developers (Objective-C geeks)

  • We would like to be sure that we can carry on developing our applications in the feature without them getting broken due to new OS or APIs

  • It will be beneficial to ensure before hand that the application will not be rejected due to cross platform code (mostly AppStore)

  • Like any company we would like to be as cost effective as we can - on the other hand we insist on high quality products and top-of-the-line User experience.

There is no better place to ask this question than StackOverflow, I would appreciate any comments from developers with experience on this topic.


Source: (StackOverflow)