我正在尋找一種解決方案,使用我創建的ID在我的數據存儲上設置角色。事實上,在dropbox tutorial上解釋瞭如何影響自動生成ID的數據存儲的角色。Dropbox vs Android - 可以使用「openOrCreateDatastore」設置角色嗎?
有人可以告訴我是否有解決方案來影響角色到數據存儲的名稱由應用程序的用戶確定?
我的代碼是:
title = extras.toLowerCase();
try {
datastoreTitle = mDatastoreManager.openOrCreateDatastore(title.toString());
datastoreTitle.setRole(DbxPrincipal.PUBLIC, DbxDatastore.Role.EDITOR);
} catch (DbxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
當我運行這段代碼我收到此錯誤信息:
10-31 09:11:44.883: E/AndroidRuntime(22716): FATAL EXCEPTION: main
10-31 09:11:44.883: E/AndroidRuntime(22716): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dvp_list7/com.example.dvp_list7.ListingArticlesDropb}: com.dropbox.sync.android.DbxRuntimeException$IllegalArgument: Operation setRole requires a shareable datastore.
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread.access$600(ActivityThread.java:155)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1252)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.os.Handler.dispatchMessage(Handler.java:99)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.os.Looper.loop(Looper.java:137)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread.main(ActivityThread.java:5096)
10-31 09:11:44.883: E/AndroidRuntime(22716): at java.lang.reflect.Method.invokeNative(Native Method)
10-31 09:11:44.883: E/AndroidRuntime(22716): at java.lang.reflect.Method.invoke(Method.java:511)
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-31 09:11:44.883: E/AndroidRuntime(22716): at dalvik.system.NativeStart.main(Native Method)
10-31 09:11:44.883: E/AndroidRuntime(22716): Caused by: com.dropbox.sync.android.DbxRuntimeException$IllegalArgument: Operation setRole requires a shareable datastore.
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.dropbox.sync.android.DbxDatastore.checkShareable(DbxDatastore.java:241)
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.dropbox.sync.android.DbxDatastore.setRole(DbxDatastore.java:314)
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.example.dvp_list7.ListingArticlesDropb.dataManager(ListingArticlesDropb.java:165)
10-31 09:11:44.883: E/AndroidRuntime(22716): at com.example.dvp_list7.ListingArticlesDropb.onCreate(ListingArticlesDropb.java:92)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.Activity.performCreate(Activity.java:5153)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-31 09:11:44.883: E/AndroidRuntime(22716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
10-31 09:11:44.883: E/AndroidRuntime(22716): ... 11 more
謝謝您的幫助!