×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    2

    PlatformRequest() isn't working for me

    Working on my first app ever, not just Asha 501, and still a java beginner so I'm working blind here. (Please go easy on me)

    I cannot get platformRequest() to launch the urls that I need it to.

    They look like Hyperlinks (blue and underlined) but are non-functional.

    The browser/internet works fine on the device/emulator.

    Apologies if this is answered somewhere but I could not find it on these forums or indeed anywhere else.


    Code:
    import javax.microedition.io.ConnectionNotFoundException;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.Item;
    import javax.microedition.lcdui.ItemCommandListener;
    import javax.microedition.lcdui.StringItem;
    
    public class pageView extends Form
    {
    	private StringItem stringItemLink;
    	private String urlString = "http://www.google.com";
    	private Command urlCommand;
    	MyApp myapp;
    	
    	public pageView(String title,final MyApp myApp) 
    	{
    
    		
    		super(title);
    		this.myApp = myApp;
    		this.append("The webpage I want is here:");
    
    		urlCommand = new Command(urlString, Command.ITEM, 1);
    		setStringItemLink(new StringItem(null, "Link Name", Item.HYPERLINK));
    		StringItemLink.addCommand(url);
    		StringItemLink.setItemCommandListener(new ItemCommandListener() 
                   {
    		            public void commandAction(Command c, Item item) {
    		                    try {
    		                    	myApp.platformRequest(urlString);
    		                    } catch (ConnectionNotFoundException ex) {
    		                    }
    		            }
    		        });
    
    this.append(getStringItemLink());
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: PlatformRequest() isn't working for me

    Note that this snippet would not compile in its current form. Perhaps just variables were renamed for the post, but if you changed it substantially, it is going to be difficult to find out what happened in the original.
    Steps you could try are
    - making sure that the command is actually executed, in the emulator it is rather painless, just put a breakpoint into the handler and the debugger will tell
    - checking if the exception gets raised for any reason
    - with the Asha platform, some actions have to be performed in secondary threads, http://developer.nokia.com/Resources...-commands.html and http://developer.nokia.com/Resources...tive-apis.html tells about them. While platformRequest is not listed in the articles, you may try wrapping it into a thread and see what happens

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    2

    Re: PlatformRequest() isn't working for me

    Yes, I had to rename variables and it's not the complete code either. I will give that a try, Thank you!

Similar Threads

  1. platformRequest
    By dekuryu in forum Mobile Java General
    Replies: 7
    Last Post: 2010-09-14, 06:38
  2. platformrequest help
    By binli120 in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2007-09-14, 01:38
  3. Ask for help about platformRequest
    By JandyKwan in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 1
    Last Post: 2007-08-29, 09:54
  4. N90 and platformRequest
    By Martin Valfridsson in forum Mobile Java General
    Replies: 0
    Last Post: 2006-03-09, 09:17
  5. platformRequest using S40
    By halofolks in forum Mobile Java General
    Replies: 2
    Last Post: 2005-08-26, 14:11

Posting Permissions

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