×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Canvas not displayed in NOKIA 7210

    Hi,

    My Midlet is running well in emulator. But the same application when I deployed in Nokia 7210 Supernova, the Canvas is not displayed. The Ticker appended to the Canvas is Displayed.



    Suggestion appreciated in advance.
    Last edited by bidyut84; 2010-01-22 at 12:35.

  2. #2
    Registered User
    Join Date
    Aug 2008
    Posts
    39

    Re: Canvas not displayed in NOKIA 7210

    Could you post any code so we can atleast get a hint what might be the problem. Any exceptions?

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Canvas not displayed in NOKIA 7210

    Do you mean this 7210 (supernova), or this, original 7210?

    The original 7210 is CLDC-1.0, MIDP-1.0, and if you have used features of CLDC-1.1 or MIDP-2.0, your application will not work. Develop for CLDC-1.0/MIDP-1.0 if you want to use your application on a device with that specification.

    Graham.

    Edit: Ah, I see you've edited your original post after reading my reply, so you no longer talk about a MIDP-1 7210.
    Last edited by grahamhughes; 2010-01-23 at 11:00. Reason: Original post has been edited.

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210 Supernova

    package hello;

    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Font;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.midlet.*;


    public class TestMidlet extends MIDlet {
    public void startApp() {
    TestCanvas TCObject = new TestCanvas();
    Display.getDisplay(this).setCurrent(TCObject);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    }

    class TestCanvas extends Canvas{

    protected void paint(Graphics g) {
    g.setColor(0,0,0);
    Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL);
    g.setFont(font);
    g.drawRect(0,0,getWidth(),getHeight());
    g.setColor(255,255,255);
    g.drawString("Welcom to 3G", 0, 0, 0);
    }

    }
    Last edited by bidyut84; 2010-01-22 at 13:16.

  5. #5
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210

    Below is the code I am using to display the Canvas in a nokia device. The Device is showing on ly a white screen, No Exception.

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Canvas not displayed in NOKIA 7210 Supernova

    Quote Originally Posted by bidyut84 View Post
    g.drawString("Welcom to 3G", 0, 0, 0);
    This line is incorrect. You must specify an anchor, you cannot put "0".

    Code:
    g.drawString("Welcom to 3G", 0, 0, Graphics.TOP | Graphics.LEFT);
    Graham.

  7. #7
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210

    Below is the part of my actual code, the varriable path is the first part of the url which gives the Background Image and audio.

    fieldarray is a string array .


    Note the point that the code is working fine in emulator.

    All the background images and audio are coming accordingly.
    But in nokia 7210 Supernova , its displaying only a white screen.





    protected void paint(Graphics g) {
    width = getWidth();
    height = getHeight();

    g.setColor(255, 0, 0);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(255, 255, 255);
    g.fillRect(0, 0, width - 1, height - 1);
    try
    {
    g.drawImage(getImage(path + bgImg + ".png"),0, 0, Graphics.TOP | Graphics.LEFT);
    }catch(Exception e)
    {
    e.printStackTrace();
    }
    g.setColor(255, 255, 255);

    int y = 20;
    g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
    g.drawString(header, 70, 0, Graphics.TOP| Graphics.LEFT);
    for (int i=0;i<fieldArray.length;i++){
    y = y+40;
    g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_MEDIUM));

    g.drawString(fieldArray[i] , 50, y, Graphics.TOP | Graphics.LEFT);
    }
    if(!audioStr.equals("") && !audioStr.equals("null")){
    String audio=path + audioStr +".amr";
    //play(path + audioStr + ".amr");
    play(audio);
    }

    }

  8. #8
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210 Supernova

    Quote Originally Posted by grahamhughes View Post
    This line is incorrect. You must specify an anchor, you cannot put "0".

    Code:
    g.drawString("Welcom to 3G", 0, 0, Graphics.TOP | Graphics.LEFT);
    Graham.

    I think the number 0 represants the anchor point Graphics.TOP | Graphics.LEFT

  9. #9
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Canvas not displayed in NOKIA 7210 Supernova

    Quote Originally Posted by bidyut84 View Post
    I think the number 0 represants the anchor point Graphics.TOP | Graphics.LEFT
    No, it doesn't. You cannot put zero.

    Are you saying that this didn't fix the original code you posted?

  10. #10
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Canvas not displayed in NOKIA 7210

    It's hard to say without seeing all the code. The problem might lie in the paint() method.

    Quote Originally Posted by bidyut84 View Post
    Code:
    g.drawImage(getImage(path + bgImg + ".png"),0, 0, Graphics.TOP | Graphics.LEFT);
    How is getImage() working? What is the path? Ideally, load images in advance of paint(). As with any event method, paint() should return as quickly as possible, and you should avoid slowing it down with IO operations. The path for an image should start with "/" if using createImage(). Note that createImage() does not take a URL as it's argument.

    Quote Originally Posted by bidyut84 View Post
    Code:
    if(!audioStr.equals("") && !audioStr.equals("null")){
        String audio=path + audioStr +".amr";
        //play(path + audioStr + ".amr");
        play(audio);
    }
    It's also a bad plan to play audio in the paint() method. The paint() method is for painting. Don't do anything else.

    This part may be the source of your problem. In particular, why are you comparing audioStr with the string "null"? Possibly, audioStr is null (not "null"), and this is throwing a NullPointerException. Try changing this to:

    Code:
    if (audioStr != null && audioStr.length() > 0) {
    You must have the check for null on the left of the &&. If the left-hand expression is false, the right-hand expression will not be evaluated. This will prevent the right-hand expression from throwing a NullPointerException if audioStr is null.

    It's also possible that the problem occurs somewhere else, such as startApp().

    Graham.

  11. #11
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210

    I have found the cause of the problem, Actually we are using a tomcat Server as our web server. The problem is that midlet is not able to get any Image or audio from the sever.

    when I use a static image then the application is running well but audio and text content that we are trying to get from server are not playing or shown.

    Any advice ?

  12. #12
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: Canvas not displayed in NOKIA 7210

    what do you mean by using static images ????????

    Moreover after reading the whole scenario I guess you are downloading the images , sound, text from your server and using it in your app and as u say now u used static image I think u are using an image bundled with your midlet but still using the sound and text from server by downloading m I correct
    Regards,
    Saurabh

  13. #13
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Re: Canvas not displayed in NOKIA 7210

    Quote Originally Posted by ingsaurabh View Post
    what do you mean by using static images ????????

    Moreover after reading the whole scenario I guess you are downloading the images , sound, text from your server and using it in your app and as u say now u used static image I think u are using an image bundled with your midlet but still using the sound and text from server by downloading m I correct
    Yeah...U are absolutely correct ingsaurabh. Any suggestion ??

  14. #14
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: Canvas not displayed in NOKIA 7210

    sorry for late reply well if dat the case then since you are saying that when u use bundled images they work so its problem with ur server or either with your code through which you are fetching all dat resources

    Try using all resources(images, sound, text) as static i.e bundled them in ur midlet and gave it a blow
    Regards,
    Saurabh

  15. #15
    Registered User
    Join Date
    Dec 2009
    Posts
    46

    Question Re: Canvas not displayed in NOKIA 7210

    Thanks for advice buddy. But with my lill knowledge what I found is, if there is an issue related to code, then it wouldnt work in emulator also. Isn't ?

Similar Threads

  1. which phones for laptop
    By dvdljns in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2006-02-14, 12:58
  2. Series 60 Concept Emulator (SDK Beta 0.2 Linux) not working
    By mattbee in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2003-06-10, 11:43

Posting Permissions

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