(Gallery起動的に)ハニコム対応したよw みたいな

Honeycomb端末手に入れました。
自分のアプリからGalleryアプリを起動しようとしたら異常終了してたので対応したよ。
FragmentだのActionBarだのはまだまだこの後。
っていうか、何とかしてくれ、このバージョン依存コードw
この手がダメならあの手であの手がダメならこっちから攻めてそれでもダメならHTCだろ--!!!みたいな。


// ギャラリー表示
Intent intent = null;
try
{
// for Hanycomb
intent = new Intent();
intent.setClassName("com.android.gallery3d", "com.android.gallery3d.app.Gallery");
startActivity(intent);
return;
}
catch(Exception e)
{
try
{
// for Recent device
intent = new Intent();
intent.setClassName("com.cooliris.media", "com.cooliris.media.Gallery");
startActivity(intent);
}
catch(ActivityNotFoundException e1)
{
try
{
// for Other device except HTC
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("content://media/external/images/media"));
startActivity(intent);
}
catch (ActivityNotFoundException e2)
{
// for HTC
intent = new Intent();
intent.setClassName("com.htc.album", "com.htc.album.AlbumTabSwitchActivity");
startActivity(intent);
}
}
}

コメント

  1. HTC Sensationの場合は

    intent.setClassName("com.htc.album", "com.htc.album.AlbumMain.ActivityMainDropList")

    でした :(

    返信削除

コメントを投稿

このブログの人気の投稿

Execノードを使う

Joinノードを使う(その4)

SendGridのX-SMTPAPIヘッダの使い方(Section Tags、Substitution Tags編)