开发者

BlackBerry app "no Application instance" error

I want this non-ui app to open from an icon press and then invoke the memopad to make a new memo. But when I run it from the icon click I get,

""Uncaught exception: no Application instance""

What am I doing wrong? I extended the Application to say it is non-ui. The Invoke.invoke ... code is correct I know. It has something to do with the struct and instance of the app. But I'm stumped.

package mprn;

import net.rim.blackberry.api.invoke.*;
import net.rim.device.api.system.Application;

public class memopadrn extends Application 
{

 public static void main(String[] args)
     {
  Invoke.invokeApplication(Invoke.APP_TYPE_MEMOPAD开发者_运维知识库, new MemoArguments(MemoArguments.ARG_NEW));
  }  
 }


Your application never enters into the Event Dispatcher, try this (untested):


import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.MemoArguments;
import net.rim.device.api.ui.UiApplication;

public class Memopadrn extends UiApplication {

    public static void main(String[] args) {
        new Memopadrn().enterEventDispatcher();
    }

    public Memopadrn() {
        Invoke.invokeApplication(Invoke.APP_TYPE_MEMOPAD, new MemoArguments(MemoArguments.ARG_NEW));
        System.exit(0);
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜