You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:30

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
Hello,

i created a MIDlet which works on my N95 an other Nokia phones, but does not work on Sony Ericsson Phones, although they have MIDP-2.0 and CLDC-1.1. On some Sony Ericssons it can be installed, but can not be started, on other Sony Ericssons it can't be installed...

The MIDlet uses Canvas, but no other important functions.

What can be the reason, that it does not work on the SE phones?

Thanks
Reply With Quote

#2 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:33

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
Can you say more about the problem? What happens when you try to install it, or run it?

What is the size of the JAR file?

Graham.
Reply With Quote

#3 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:38

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
Hello,
the size of the .jar File is 85kb.
I have a friend here, he has a SE M600i, he can install the MIDlet, but if he starts it, the JAVA Logo appears, but then nothing happens. On a K550i i can't be installed, if you install it, there i an error: Fehler in der Anwendung, that means Error in the application.

The Midlet starts an does first do nothing else than show a blue background, painted with canvas, and an image, created on that background, with canvas, too.
Reply With Quote

#4 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:42

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
hhmm.. maybe some exceptions are thrown ? do you have try-catch around the code that might throw exceptions ? as in : do you have used any exception-handling ? :D
personally I've had some problems with internet-connections with SE and Samsung but most of the time Canvas stuff (especially simple stuff) actually ran pretty fine...
is there maybe some kind of SE emulator around to try it on and see if exceptions/errors arise ?
Reply With Quote

#5 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:45

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
Hmm.. I am sure that i catch every error, for example when i create the image logo on startup... i try to make it more simple to find out, why it doesnt start on SE phones. If I found any solution i will report it here :)
Reply With Quote

#6 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:47

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
that logo you are mentioning how big is it ? might it be some kind of outofmemory error which doesnt get handled well by the underlying OS ?
Reply With Quote

#7 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:49

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
This code is for the startup:

Code:
    //Standardkonstruktor
    public Carfinder() {
        try {
            imageMenue = Image.createImage("/Menu.png");
            imageLogo = Image.createImage("/Logo.png");
        } catch (Exception e) {
            e.printStackTrace();
            imageMenue = null;
            imageLogo = null;
        }
        ck = new CanvasKlasse();
    }


    //Starten der Applikation
    public void startApp() {
        display = Display.getDisplay(this);
        grafikCode = 0;
        ck.repaint();
        display.setCurrent(ck);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
        mainScreen();
    }

    public void mainScreen() {
        scrollX = 0;
        scrollY = 0;
        display = Display.getDisplay(this);
        grafikCode = 1;
        ck.repaint();
        ck.removeCommand(start);
        ck.removeCommand(zurueckMenue);
        ck.removeCommand(zurueckStart);
        ck.removeCommand(ja);
        ck.removeCommand(nein);
        ck.removeCommand(browser);
        ck.addCommand(ende);
        ck.addCommand(car2go);
        ck.addCommand(hilfe);
        ck.addCommand(info);
        ck.addCommand(test);
        ck.addCommand(webapp);
        ck.setCommandListener(this);
        display.setCurrent(ck);
    }
Then there is the Canvas class, where it is painted...
Reply With Quote

#8 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:51

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
Here the size of the 2 created images:

Menu.png = 46kb
Logo = 8kb

Can this be the problem?
Reply With Quote

#9 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:52

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
M600 is a Symbian UIQ device (think of it like Sony's equivalent of Series 60), while the K550 is more like Sony's equivalent of Series 40. So it's not surprising that the two behave differently.

You say on the K550, you get "error in the application" when you install it (you do not have a chance to try starting the application)? How are you installing? OTA, Bluetooth, etc.? Do you install both JAD and JAR, or just JAR?

Sony's emulators are usually just the Sun WTK emu reskinned. However, most Sony devices support on-device debugging, so it is well worth downloading the Sony SDK from the Sony Ericsson Developer World site.

Graham.
Reply With Quote

#10 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:56

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
Oh, you should certainly avoid calling sleep() in startApp()!

Event methods that are called by the device itself (like startApp(), keyPressed(), paint() and so on) should return as quickly as possible.

You also have many calls to repaint() and setCurrent() for the same Displayable object. There is no point repaint()ing a Canvas that is not yet current. It will automatically repaint() when it becomes current.

Avoid doing anything in the MIDlet constructor.

Graham.
Reply With Quote

#11 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:57

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
On K550i there is no chance to start it. I sent him the jar without jad over BT.

I will try the Sony SDK, but later I am in school...
Reply With Quote

#12 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 12:58

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
that 46 kb png whats its resolution in pixels ?
Reply With Quote

#13 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 13:02

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
Can you post the contents of your JAR's MANIFEST file?
Reply With Quote

#14 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 16:12

Join Date: Apr 2009
Posts: 30
carsamba55
Offline
Registered User
Quote:
Can you post the contents of your JAR's MANIFEST file?
Manifest File:

Code:
MIDlet-1: Carfinder,/Icon.png,SymbianPart.Carfinder
MIDlet-Vendor: Vendor
MIDlet-Name: Carfinder
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0

Quote:
that 46 kb png whats its resolution in pixels ?
200x200 pixels.

I will try later without creating images, then I know if the problem is made by the images.
Now I cant try, cause I have no SE phone here :)

Quote:
Oh, you should certainly avoid calling sleep() in startApp()!
OK i'll will remove it...

Quote:
Avoid doing anything in the MIDlet constructor.
Why? I saw many examples in the www, and most of them put code like this in the standardconstr...


Thanks for your help and attention everybody, this is my first j2me project, i was helped a lot in this forum, next week i must demonstrate it to my prof at the university... therefore i wanted to test it on other phones...
Reply With Quote

#15 Old Re: MIDlet works on Nokia but not on Sony Ericsson - 2009-06-04, 16:35

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
Quote:
Originally Posted by carsamba55 View Post
Manifest File:

Code:
MIDlet-1: Carfinder,/Icon.png,SymbianPart.Carfinder
MIDlet-Vendor: Vendor
MIDlet-Name: Carfinder
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
OK... two things:

1. I suggest you change the version number to 1.0.0 - this is the prefered format.

2. Is your icon image file called "Icon.png", or "icon.png"? The name needs to match precisely.

Quote:
Originally Posted by carsamba55 View Post
Why? I saw many examples in the www, and most of them put code like this in the standardconstr...
Two reasons:

1. Again, this is a method invoked by the device, and should return quickly. In particular, avoid anything that is time consuming, such as loading resources.

2. This is the application object, and it may be in an uncertain state until it has finished constructing. You are likely to get different behaviours on different devices. Display.getDisplay(midlet) might not work correctly, for example, because the midlet is not completely constructed yet.

Also:

Are you image file named "Logo.png" and "Menu.png", or "logo.png" and "menu.png"?

When you load these images, you handle any exceptions by setting the variables to null. This is a bad plan. How do you handle the situation where these variables are null in, say, the paint() method? Probably, you just get a NullPointerException thrown later (which maybe you are also catching and ignoring). Exceptions are there to help you track problems. Writing catch{} blocks that just swallow exceptions and allow the program to carry on usually results in bugs that are hard to trace.

Graham.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
###Upgrading Firmware### zahid44 General Discussion 27 2008-10-21 08:17

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia