arcanum_jp’s blog

おっさんの日記

単純にギャラリーを起動する

こちらから

This piece of code just opened the gallery without any issues. Could get it working on all versions!

Thought to put it as answer for people who are looking to open a Gallery on all versions

java - Open Gallery App in Android - Stack Overflow

ちょっとこれやると例外で落ちる。

02-28 10:44:58.944  20940-20940/? W/Album﹕ Could not initialize adapter
    java.lang.IllegalArgumentException: Unknown type: UNKNOWN
            at com.sonyericsson.album.aggregator.properties.PropertiesFactory.newProperties(PropertiesFactory.java:458)
            at com.sonyericsson.album.aggregator.properties.PropertiesFactory.newProperties(PropertiesFactory.java:257)
            at com.sonyericsson.album.aggregator.properties.PropertiesFactory.newProperties(PropertiesFactory.java:511)

なんだよUNKNOWNって!っと思って次のように修正したら動いたのでメモ

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media"));
intent.setType("image/*"); // 追加行
startActivity(intent);