5 Replies - 3761 Views - Last Post: 23 February 2011 - 09:00 AM

#1 NanoTech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Calling platformRequest() in Java MIDP 2.0

Posted 21 February 2011 - 10:21 AM

Hi there,

I have recently been using the Java ME features of Netbeans and the SVG UI snippets plug in and I would like to open a website with the default web browser on the phone through my midlet.

To do this, I would like to know how I can use the platformRequest() method call (from the Midlet class) in my Java ME application.

Specifically, I would like to be able to click on an button and it calls this method, subsequently opening the page.

Could anyone offer some advice on ways in which I can call platformRequest()?

Thanks,
NanoTech

Is This A Good Question/Topic? 0
  • +

Replies To: Calling platformRequest() in Java MIDP 2.0

#2 mi14chal  Icon User is offline

  • D.I.C Head

Reputation: 82
  • View blog
  • Posts: 202
  • Joined: 11-December 10

Re: Calling platformRequest() in Java MIDP 2.0

Posted 21 February 2011 - 10:31 AM

For example:

//in your midlet
platformRequest("www.google.com");

Was This Post Helpful? 1
  • +
  • -

#3 NanoTech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Re: Calling platformRequest() in Java MIDP 2.0

Posted 21 February 2011 - 12:43 PM

Thank you for your response.

I'm not completely sure where to call this method in Netbeans. I'm trying to customise the generated code for an SVG button such that it can direct the user to the site when an action is performed on the button.

I want to stick to the forum rules and not simply ask for code, but what do you think I should consider here?

I've tried adding that method to parts of my code with no working result so far :)

Let me know if I have not provided enough information.


public SVGButton getStoreButton() {
        if (storeButton == null) {                                   
            
            storeButton = new SVGButton(getSvgForm(), "button_1");                                      
            storeButton.setText("Store");                                    
           
        }                                        
        return storeButton;
    }


This post has been edited by NanoTech: 21 February 2011 - 12:48 PM

Was This Post Helpful? 0
  • +
  • -

#4 mi14chal  Icon User is offline

  • D.I.C Head

Reputation: 82
  • View blog
  • Posts: 202
  • Joined: 11-December 10

Re: Calling platformRequest() in Java MIDP 2.0

Posted 21 February 2011 - 12:59 PM

You add ActionListener for SVGButton and then will call function platformRequest();
Was This Post Helpful? 1
  • +
  • -

#5 NanoTech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Re: Calling platformRequest() in Java MIDP 2.0

Posted 23 February 2011 - 08:35 AM

Thanks again,

Is there some additional parenthesis I require or is this the incorrect way to call an additional method?

public SVGButton getStoreButton() {
        if (storeButton == null) {
            // write pre-init user code here
            storeButton = new SVGButton(getMainMenu(), "button_1");
            storeButton.setText("Store");
            storeButton.addActionListener(new SVGActionListener() {
            public void actionPerformed(SVGComponent svgComponent) {
                platformRequest("www.java.com");
                }          


Was This Post Helpful? 0
  • +
  • -

#6 NanoTech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-February 11

Re: Calling platformRequest() in Java MIDP 2.0

Posted 23 February 2011 - 09:00 AM

*Update*

I managed to complete the code and it works a treat!

Thanks for the pointers and +2 for reputation :)

This post has been edited by NanoTech: 23 February 2011 - 09:04 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1