Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuitsjp/a0f01f2db64877e304325ac3d44f941b to your computer and use it in GitHub Desktop.
Save nuitsjp/a0f01f2db64877e304325ac3d44f941b to your computer and use it in GitHub Desktop.
// SDカードがマウントされているか確認する
if(Android.OS.Environment.ExternalStorageState == Android.OS.Environment.MediaMounted)
{
var fileName = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "0000.png");
// 画像ファイルの存在確認
if(File.Exists(fileName))
{
var bitmap = Android.Graphics.BitmapFactory.DecodeFile(fileName);
ImageButton imageButton = FindViewById<ImageButton>(Resource.Id.MyImageButton);
imageButton.SetImageBitmap(bitmap);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment