如何解决Twitter4j 2.2.2的问题可序列化无法解决
| 我试图在blackBerry SO 5.0.0上使用twitter4j,我确实将Twitter4j 2.2.2导入到项目中。 导入所需的类后,错误出现在行“ 0”。 错误:无法解析类型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;
}
// ...
}
解决方法
这表明该程序包是为Java SE开发的,无法在JME的Blackberry上使用。
每当您看到该错误消息引用java.something中的类时,这应该是您的结论。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。