-1

アクティビティを開始し、電話のギャラリーにすでにある写真を(ユーザーの操作なしで)取得して、そのうちの1つをアクティビティに表示したいだけです。それは可能ですか?

よろしく、マティアス

4

1 に答える 1

0

このコードを使用してギャラリーの画像を取得します

Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, 1);

protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK)
    {
        Uri chosenImageUri = data.getData();

        Bitmap mBitmap = null;
        mBitmap = Media.getBitmap(this.getContentResolver(), chosenImageUri);
        }
}
于 2012-06-13T15:30:42.823 に答える