Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
sneg
Posts: 50
Registered: 12-23-2009
Accepted Solution

Project that supports both touch-screen and non-touch screen devices.

    Our team works on BB application which is oriented on a wide set of supported devices. It should support devices with OS version 4.2 - 5.0. We decided to use API of v4.2 OS. Then our application would be supported by all newer devices. It was successful way till the recent time. Problems arose when we started to use navigationMovement() function to handle movement event. This function works fine on devices with track-ball and it doesn't work on touch-screen devices. On touch-screen devices we should override touchEvent() function.

   When we added touchEvent function to our project then the project couldn't be started on devices with OS < v4.7 (Error starting application: Class 'net.rim.device.api.ui.TouchEvent' not found). So I think we should split our project in two branches: the first will support  touch screens and the second one will not. There will be two shortcomings in this approach:

1. We'll have to watch over corrections in two projects. It can happened that one branch was updated and the second one was missed (was forgotten for example).

2.  Instead one binary we'll have two binaries. But it simpler to have one binary which will work on all desired platforms.

 

So please give me an advice how should we update our project to make him working on TouchScreen and non-touchScreen devices.

 

Development software which we use: JDE 4.2 and JDE 4.7.

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: Project that supports both touch-screen and non-touch screen devices.

If you are manipulating focus movement using navigationMovement and you wish to do similar processing using the Touch Events, then in my opinion, you have no choice, you will need separate binaries. 

 

I've thought about this a little, here are two options I considered:

 

1) abstract the Fields into some classes that you package in a separate project/cod, then have a cod for trackball devices that uses n and one for TouchScreen devices.  Then the rest of your application remains the same,   As an example, say you create a MyField Class, then everything can derive from that - in the 4.7 version MyField will use Touch Events, in the 4.2 version it uses navigationMovement. 

 

2) have your Ui Processing in a separate project/cod for OS 4.7 and OS 4.2, so just branch the UI cod

 

However neither of these really excited me, so I use the preprocessor, have one source, and do two builds.

 

I'm sure there are better ways, just I couldn't think of any.

 

This or related issues are discussed a number of times on the forum, have a search around.

Please use plain text.
Developer
dpreussler
Posts: 212
Registered: 07-18-2008

Re: Project that supports both touch-screen and non-touch screen devices.

you could build a library project for the 4.7 based classes and use dynamicy class loading (class.forname) for them. or use preprocessor but then you would still habe 2 builds
If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Please use plain text.
New Developer
ashish_onmobile
Posts: 5
Registered: 09-26-2008

Re: Project that supports both touch-screen and non-touch screen devices.

We were facing the same problem. so we decided to use //#preprocess

 

we are using JDE 4.7 and we can build for all OS 4.2 > .

 

We are using same source code for Touch and Non Touch.

 

May be this could be another solution.

 

Thanks and Regards,

Ashish

Please use plain text.