×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    153

    how we can instantiate midlet class in another class in j2me

    hii.
    I am working on nokia asha sdk2.0 using lwuit1.5 .now my problem is that i want to instantiate the midlet class and use the object of midlet class to call method in another class .then an exception is occur which is
    " java.lang.SecurityException: MIDletManager ERROR: Illegal attempt to construct groove.MainUI@feb3d00a"
    how can i use the object of midlet class in another classes.
    please help me

  2. #2
    Registered User
    Join Date
    Dec 2012
    Location
    India
    Posts
    264

    Re: how we can instantiate midlet class in another class in j2me

    You cannot start a new MIDlet via code.This is for security reasons.

    What are you trying to achieve ? We can possibly find a workaround.

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: how we can instantiate midlet class in another class in j2me

    i have a method in midlet class i want to call this mehtod in another simple java class in same package .so tell me how i can do it

  4. #4
    Registered User
    Join Date
    Dec 2012
    Location
    India
    Posts
    264

    Re: how we can instantiate midlet class in another class in j2me

    Pass an instance of your class.Here is a an example code
    Code:
    class MyApp extends MIDlet
    {
    ...
    public void methodToBeCalled()
    {
    ..do something..
    }
    public void secondClassInitMethod()
    {
    SecondClass sc = new SecondClass(this);
    sc.methodThatCalls();
    }
    }
    
    
    }
    class SecondClass
    {
    MyApp ma;
    
    SecondClass(MyApp ma)
    {
    this.ma = ma;
    }
    
    public void methodThatCalls()
    {
    ma.methodToBeCalled();
    }
    }

  5. #5
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: how we can instantiate midlet class in another class in j2me

    thanks Arunkam its working well.

Similar Threads

  1. Midlet to call a j2me java class
    By kakinyim in forum Mobile Java General
    Replies: 5
    Last Post: 2011-05-18, 20:25
  2. how to instantiate TLinearOrder<class T>
    By chandra1234 in forum Symbian
    Replies: 2
    Last Post: 2008-09-11, 09:25
  3. Cannot instantiate abstract class!!!!
    By Tanya in forum Symbian
    Replies: 3
    Last Post: 2007-09-01, 14:10
  4. how do you instantiate the class MFKey.. pls help
    By pawangjain in forum Near Field Communication
    Replies: 1
    Last Post: 2007-07-04, 11:19
  5. cannot instantiate abstract class...
    By sbleriot in forum Symbian
    Replies: 1
    Last Post: 2002-11-08, 12:29

Posting Permissions

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