我已经提到了this,我已经成功集成了,现在我想从应用程序创建Notebook,因为我尝试了下面的代码,但我每次都会遇到异常。
Note myNote = new Note();
myNote.setTitle("My Test Notebook");
createNoteInAppLinkedNotebook(myNote, new OnClientCallback<Note>() {
@Override
public void onSuccess(Note data) {
}
@Override
public void onException(Exception exception) {
Log.e(TAG, exception.toString());
}
});
@SuppressWarnings("deprecation")
protected void createNoteInAppLinkedNotebook(final Note note,final OnClientCallback<Note> createNoteCallback) {
showDialog(DIALOG_PROGRESS);
invokeOnAppLinkedNotebook(new OnClientCallback<Pair<AsyncLinkedNoteStoreClient, LinkedNotebook>>() {
@Override
public void onSuccess(
final Pair<AsyncLinkedNoteStoreClient, LinkedNotebook> pair) {
pair.first.createNoteAsync(note, pair.second,
createNoteCallback);
}
@Override
public void onException(Exception exception) {
Log.e(LOGTAG, "Error creating linked notestore", exception);
Toast.makeText(getApplicationContext(),R.string.error_creating_notestore, Toast.LENGTH_LONG).show();
removeDialog(DIALOG_PROGRESS);
}
});
}
我每次都错误创建链接的notestore 异常。
有相同的解决方案吗?
答案 0 :(得分:1)
最后我找到了自己的问题解决方案:
Notebook nb = new Notebook();
nb.setName("My Test Notebook");
try {
AsyncNoteStoreClient asyncNoteStoreClient = mEvernoteSession.getClientFactory().createNoteStoreClient();
asyncNoteStoreClient.createNotebook(nb, new OnClientCallback<Notebook>() {
@Override
public void onSuccess(Notebook data) {
Log.i(TAG, "onSucceess");
}
@Override
public void onException(Exception exception) {
Log.i(TAG, "onException");
}
});
} catch (TTransportException e) {
e.printStackTrace();
}