couchbase todolist get database sync part
https://github.com/couchbaselabs/ToDoLite-Android
Write ToDoLite database sync guy is very good.
OK, take out.
android studio:new project then
- Copy todolist four java :
Application.java、BaseActivity.java、Preferences.java、Synchronize.java
- Edit java : MainActivityjava、AndroidManifes.xml
1、app/src/main/AndroidManifest.xml
<application
add android:name=“com.sandk.groupaccountbook.Application”
2、app/src/main/java/com/sandk/groupaccountbook/MainActivity.java
change public class MainActivity extends ActionBarActivity =>
public class MainActivity extends BaseActivity {
If have new activity, just change extends to BaseActivity, then can use application.getDatabase().
four java : any use facebook just // or delete
now database = application.getDatabase() is ok~~
==========
主要是新增四支java和二個設定
從todolist copy 四支為:
Application.java、BaseActivity.java、Preferences.java、Synchronize.java
變更設定為:MainActivityjava、AndroidManifes.xml
差別閱github版本差異 官方寫的非常漂亮,可以切開來
- app/src/main/AndroidManifest.xml
<application
add android:name=“com.sandk.groupaccountbook.Application”
- app/src/main/java/com/sandk/groupaccountbook/MainActivity.java
change public class MainActivity extends ActionBarActivity =>
public class MainActivity extends BaseActivity {
別忘記最重要的, MainActivity extends 要改成 BaseActivity
將來有新的Activity extends BaseActivity 就行用了!
把四支新增 java,裡面有facebook 部份註解掉,基本上就能使用了
寫程式就可以用 database = application.getDatabase()