アクティビティを開始し、電話のギャラリーにすでにある写真を(ユーザーの操作なしで)取得して、そのうちの1つをアクティビティに表示したいだけです。それは可能ですか?
よろしく、マティアス
このコードを使用してギャラリーの画像を取得します
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);
}
}