【android】DrawableとBitmap、リソースの相互変換
公開日:
:
android
Resource → Bitmap
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon)
Resource → Drawable
Drawable draw = getResources().getDrawable(R.drawable.icon)
Drawable → Bitmap
Bitmap bm = ((BitmapDrawable) drawable).getBitmap()
Bitmap → Drawable
Drawable draw = new BitmapDrawable(bitmap)
関連記事
-
-
ダイアログを表示する
カスタムアラートダイアログ private void showCustomAlert(A
-
-
【android】 年月だけのDatePicker
final DatePicker datePicker = new DatePicker(sel
-
-
【android】任意のスレッドで処理を行う
非UIスレッドでUIを操作したい場合に、任意の処理をUIスレッド上で実行する。 目次
-
-
【android】IMEの表示/非表示
//IMEを閉じる InputMethodManager inputMethodManager
-
-
[android] モンキーテスト(Monkey Test)を実行する
最近テストの効率化に目覚めました。 モンキーテストは猿にアプリを渡してみてめちゃくちゃな操作をさせ
-
-
【android】アプリのバージョン情報を取得する
int versionCode = -1; String versionName = &quo
-
-
【android】バイブレーションを使う
必要なファイル MyApp.manifest MyApp.java MyApp.m
-
-
【android】設定画面の作成
res/xml/preferences.xml <?xml version=&quo
-
-
[android] ActivityとFragmentのライフサイクルいろいろ
Fragmentを使い始めてライフサイクル関係でハマることがあったので備忘録。 FragmentA
-
-
【android】 adbコマンド集
●adbサービス起動 adb start-server ●adbサービス終了 adb
- PREV
- インテント
- NEXT
- アプリ間連携 Intentfiler