Twitter4j的问题2.2.2 Serializable无法解决

时间:2011-04-18 22:09:07

标签: blackberry java-me oauth twitter4j serializable

我正在尝试在blackberry SO 5.0.0上使用twitter4j,我确实将Twitter4j 2.2.2导入到项目中。

导入所需的类后,错误将显示在第twitter.setOAuthConsumer("Consumer Key","Secret Key");行。

  

错误:无法解析java.io.Serializable类型。它是   间接引用所需的.class文件

我可以毫无问题地从lib导入所有类,似乎问题不存在。

public class HelloWorld extends UiApplication 
{
public static void main(String[] args) 
{
    HelloWorld theApp = new HelloWorld();
    theApp.enterEventDispatcher();
}


public HelloWorld() 
{

    //MessengerContact contact =  BlackBerryMessenger.getInstance().chooseContact();
    //if(contact!=null)
    //contact.getContactId();

    HelloWorldScreen h = new HelloWorldScreen();
    pushScreen(h);
}

}

我的主屏幕就像这样

class HelloWorldScreen extends MainScreen 
{

public static int level=0;
public HelloWorldScreen() 
{
    super();
    LabelField title = new LabelField("BBM", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    setTitle(title);

    addMenuItem(new MenuItem("BBM", 10, 10) {  
        public void run() {  
          //
            try{
                BrowserField bf = new BrowserField();
                UiApplication.getUiApplication().getActiveScreen().add(bf);

                Twitter twitter = new TwitterFactory().getInstance();
                twitter.setOAuthConsumer("XvQQ1trJYrSddj5bxp8mBg", "QrE6kZRtaz3xedH4KhP1c210hVjMDZknyjAgh0Q9w");

                RequestToken requestToken = twitter.getOAuthRequestToken();
                AccessToken accessToken = null;
                //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                while (null == accessToken) {
                System.out.println("Open the following URL and grant access to your account:");

                //bf.requestContent(new StringBuffer().append(requestToken.getAuthorizationURL()));
                System.out.print("Enter the PIN(if available) or just hit enter.[PIN]:");
                AutoTextEditField pin = new AutoTextEditField("Ingrese PIN(*)", "");
                /**
                try{
                if(pin.length() > 0){
                accessToken = twitter.getOAuthAccessToken(requestToken, pin);
                }else{
                accessToken = twitter.getOAuthAccessToken();
                }
                } catch (TwitterException te) {
                if(401 == te.getStatusCode()){
                System.out.println("Unable to get the access token.");
                }else{
                te.printStackTrace();
                }
                }
                **/
                }
                //persist to the accessToken for future reference.
                //storeAccessToken((int) twitter.verifyCredentials().getId() , accessToken);
                Status status = twitter.updateStatus("prueba");
                //System.out.println("Successfully updated the status to [" + status.getText() + "].");

            }catch(Exception e){
                UiApplication.getUiApplication().getActiveScreen().add(new RichTextField(e.getMessage()));
            }
        }  
    }); 


 }

public boolean onClose() 
{

    Dialog.alert("Goodbye!");
    System.exit(0);
    return true;
}



// ...  


}

1 个答案:

答案 0 :(得分:1)

这表明该软件包是为Java SE开发的,不适用于JME的Blackberry。

每当你看到引用java.something中的类的错误消息时,这应该是你的结论。