×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Question Using platformRequest(url) to open RealPlayer doesn't work ? please help !

    Hi all. I'm trying to open a RTSP stream using real player with my J2ME application. but I get the error
    Cannot make a static reference to the non-static method platformRequest(String)
    at the line
    Code:
    MIDlet.platformRequest(url);
    Can you please check my code ? what am I doing wrong ? what should I do to make this work ?
    ps: I'm working on nokia e65, MIDP 2.0 CLDC 1.1

    here's my code
    Code:
    //imports here
    
    public class VideoCanvas extends Form implements CommandListener
    {
    
    	private Command start;
    	private Command back;
    	private Command exit;
    	private Command rotateLeft;
    	private Command rotateRight;
    	private String url;
    
    	VideoCanvas(String url)
    	{
    		super("MHSS");
    		{
    			start = new Command("Start",Command.OK,0);
    			back = new Command("Back",Command.OK,0);
    			exit = new Command("Exit",Command.BACK,0);
    			rotateLeft = new Command("Turn Camera Left",Command.OK,0);
    			rotateRight = new Command("Turn Camera Right",Command.OK,0);
    
    			this.url = url;
    			addCommand(start);
    			addCommand(rotateLeft);
    			addCommand(rotateRight);
    			addCommand(back);
    			addCommand(exit);
    			setCommandListener(this);
    		}
    	}
    
    	public void commandAction(Command c, Displayable arg1) {
    		if(c == start)
    		{
    			try
    			{
    				MIDlet.platformRequest(url); //this is where I get the error ????
    			}
    			catch (Exception e)
    			{
    				e.printStackTrace();
    			}
    		}
    		else if(c == exit) {
    			Main.midlet.notifyDestroyed();
    		}
    		else if(c == back) {
    			Main.mobileDisplay.setCurrent(Main.loginForm);
    		}
    		else if (c==rotateLeft)
    		{
    			RotateCamera rotateCameraObject = new RotateCamera("ROTATELEFT");
    			Thread rotateCameraThread = new Thread(rotateCameraObject);
    			rotateCameraThread.start();
    		}
    		else if (c==rotateRight)
    		{
    			RotateCamera rotateCameraObject = new RotateCamera("ROTATERIGHT");
    			Thread rotateCameraThread = new Thread(rotateCameraObject);
    			rotateCameraThread.start();
    		}
    
    	} 
    }

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

    Re: Using platformRequest(url) to open RealPlayer doesn't work ? please help !

    Quote Originally Posted by lunatictr View Post

    Cannot make a static reference to the non-static method platformRequest(String)
    platformRequest() is an instance method, not a class (static) method. You must invoke it with an instance of the class, not the class itself. You might want to check out your Java basics.

    You cannot create instances of MIDlet. You must use the MIDlet object created by the application manager. This is the object "this" in the startApp() method of your MIDlet class.

    Note that platformRequest() is only guaranteed to support protocols "http:" and "tel:". Other protocols might not be supported.

    Graham.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Using platformRequest(url) to open RealPlayer doesn't work ? please help !

    Quote Originally Posted by grahamhughes View Post
    platformRequest() is an instance method, not a class (static) method. You must invoke it with an instance of the class, not the class itself. You might want to check out your Java basics.

    You cannot create instances of MIDlet. You must use the MIDlet object created by the application manager. This is the object "this" in the startApp() method of your MIDlet class.

    Note that platformRequest() is only guaranteed to support protocols "http:" and "tel:". Other protocols might not be supported.

    Graham.
    Thanks for you answer, I've corrected it. It works now.
    Here's what I did.

    Main MIDlet
    Code:
    public class Main extends MIDlet
    {
    	public static Main midlet;
            //other stuff
    	public Main()
    	{
    		midlet=this;
                    //other stuff
    	}
            //MIDlet methods
    
    	
    	
    }
    And the videocanvas class
    Code:
    public class VideoCanvas extends Form implements CommandListener
    {
    
    	String url;
            //other stuff
    
    	VideoCanvas(String url)
    	{
    		super("MHSS");
    		{
    			//constructor stuff
    		}
    	}
    
    	public void commandAction(Command c, Displayable arg1) {
    		if(c == start)
    		{
    			try {
    				Main.midlet.platformRequest(url);
    			} catch (ConnectionNotFoundException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    		//other stuff
    
    	} 
    }

Similar Threads

  1. Call Back from RealPlayer
    By garg_25 in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2008-09-19, 14:17
  2. Open stream with RealPlayer
    By kota in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-11-17, 01:37
  3. XHTML : File open Error
    By as_vijay_anand in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-09-19, 06:36
  4. Replies: 3
    Last Post: 2005-10-12, 05:26
  5. CommConnection does not work with Series 60 SDK, but works in JWT
    By jackiechan2001 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2004-02-04, 09:07

Posting Permissions

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