0
链接我的Dropbox帐户后,我尝试收集数据存储名称并将其存储在本地数据库中。当我调试我的应用程序时,一切正常,我也可以在数据存储区中找到所有名称。但是当我在没有调试的情况下运行应用程序时,我的数据库似乎为空Android上的Dropbox - listDatastores不同步
我觉得有一个同步问题,有人可以给我线索?我还没有找到解决我的问题的解决方案。
谢谢,如果你能帮助我!
这是有问题的代码部分:
private void gatherData(){
db = new SQliteHelper(this) ;
Set<DbxDatastoreInfo> datastorePresent = null ;
try {
datastorePresent = mDatastoreManager.listDatastores();
} catch (DbxException e1) {
e1.printStackTrace();
}
Iterator<DbxDatastoreInfo> datastoreLoop = datastorePresent.iterator() ;
while (datastoreLoop.hasNext()){
TitleList tit = new TitleList(datastoreLoop.next().id) ;
tit.setConnectDropbox();
db.addLists(tit);
}
mDatastoreManager.shutDown();
Intent returnIntent = new Intent();
boolean syncOK = true ;
returnIntent.putExtra("result", syncOK) ;
setResult(RESULT_OK, returnIntent);
finish();
}
这可能是相同或相似的:http://stackoverflow.com/questions/23664650/dropbox-datastore-listdatastores-on-ios总之,你可能是在提醒listDatastores在SDK知道数据存储之前,所以在你的DBDatastoreManager上使用一个监听器。 – Greg 2014-10-30 17:35:04
@Greg谢谢你的帮助!的确,我曾看过这篇文章,但我不知道如何解决Android上的听众。你能举个例子吗? – KevHV 2014-10-30 17:44:43
这里的教程展示了如何将侦听器添加到DbxDatastoreManager:https://www.dropbox.com/developers/datastore/tutorial/android#listeners – Greg 2014-10-30 18:04:48