小编Ser*_*Cna的帖子

使用 greendao 中的 OpenHelper 升级数据库

我使用 GreenDao 作为我的 ORM。我想将架构从旧版本迁移到新版本。我使用此链接来实现我的 mygration。所以我编写了自己的 OpenHelper 类并将其放入另一个包中。我像这样实现 onUpgrade 方法:

public class UpgradeHelper extends OpenHelper {

public UpgradeHelper(Context context, String name, CursorFactory factory) {
    super(context, name, factory);
}

/**
 * Apply the appropriate migrations to update the database.
 */
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.i("greenDAO", "My Upgrade Helper -------- Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
    switch (newVersion) {
    case 2:
        new …
Run Code Online (Sandbox Code Playgroud)

database sqlite android greendao

5
推荐指数
1
解决办法
3275
查看次数

Android - 滑动碎片

我正在尝试实现滑动动画从fragment1转换到fragment2.我正在使用setCustomAnimations方法.我知道我需要使用frame方法来替换片段.

我的代码:

package com.example.fragmentss;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity implements MyListFragment.OnItemSelectedListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_rsslist_overview);
    }

    // if the wizard generated an onCreateOptionsMenu you can delete
    // it, not needed for this tutorial

  @Override
  public void onRssItemSelected(String link) {

  }

} 
Run Code Online (Sandbox Code Playgroud)

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

    <fragment
        android:id="@+id/listFragment"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        class="com.example.fragmentss.MyListFragment" ></fragment>

    <FrameLayout android:id="@+id/details" android:layout_weight="1"
            android:layout_width="0px" android:layout_height="match_parent"
            android:background="?android:attr/detailsElementBackground" />

</LinearLayout> 
Run Code Online (Sandbox Code Playgroud)

MyListFragment类

package com.example.fragmentss;
import …
Run Code Online (Sandbox Code Playgroud)

animation android fragment sliding

3
推荐指数
1
解决办法
7984
查看次数

标签 统计

android ×2

animation ×1

database ×1

fragment ×1

greendao ×1

sliding ×1

sqlite ×1