A Day In The Life

とあるプログラマの備忘録

M3→M5変更点

Android SDKのバージョンがM3からM5にアップしいろんな変更がありました。

気になったところをピックアップします。

  1. Content Provider関連

    ContentUriクラス名変更

     →Uri

    メソッド名変更

    OldNew
    new ContentURI(String) Uri.parse(String)
    ContentURI.create(String) Uri.parse(String)
    ContentUri.countPathSegments() Uri.getPathSegments().size()
    ContentUri.getPathSegment() Uri.getPathSegments().get()

    or

    Uri.getLastPathSegment()
    ContentURI.addPath() Uri.Builder.appendPath()
    ContentURI.addId(id) uri = Uri.withAppendedPath(SOME_URI, id);

    or uri = ContentUris.appendId(uri.buildUpon(), id).build();

  2. Xmpp関連

    com.google.android.xmppserviceパッケージ名変更

     →com.google.android.gtalkservice

    IXmppServiceインターフェース名変更

     →IGTalkService

    IXmppSessionインターフェース名変更

     →IGTalkSession

    XmppServiceConstantsクラス名変更

     →GTalkServiceConstants

    クラスおよびインターフェース追加

     →GroupChatInvitation、IChatListener、IChatSession、

      IGroupChatInvitationListener、IRosterListener

    IXmppSession#sendTextMessageメソッド廃止

     →代わりにIChatSession#sendTextMessageメソッドを使用する

  3. Notification Manager

    notifyTextメソッド廃止、Toastクラス追加

     →Toast.makeText(context, R.string.some_string, Toast.LENGTH_SHORT).show();

  4. レイアウト

    id属性名称変更

     →android:id

  5. ListView

    android:gravity属性廃止

    →setStackFromBottomメソッドを使用する。代替XML属性は無い模様

  6. SimpleCursorAdapter

    ImageViewが表示できるようなった

    setViewTextメソッド引数変更

     →setViewText(TextView v, String text)

    setViewImageメソッド追加

  7. AndroidManifest.xml

    android:value名称変更

     →android:name