*

【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)

関連記事

no image

【android】サービスの実装

ダウンロードなどActivityに依存したくない大きなバックグラウンド処理や常駐プロセスを作りたい場

記事を読む

no image

【android】リスト項目のmatch_parentが効かない

下記のようなリスト項目用のレイアウトを用意して、リストの右端にチェックボックスを置くようにしたのです

記事を読む

no image

インテント

基本 //任意のアクティビティの起動 Intent intent = new

記事を読む

no image

【android】 年月だけのDatePicker

final DatePicker datePicker = new DatePicker(sel

記事を読む

no image

【android】リソースからいろいろ取得する

リソースで定義したいろいろをコード内で呼び出す方法です。 レイアウト //リソースからレ

記事を読む

no image

【android】バイブレーションを使う

必要なファイル MyApp.manifest MyApp.java MyApp.m

記事を読む

no image

【android】非同期処理

Androidで非同期処理、マルチスレッドを処理するスニペット。 AndroidのスレッドはUIス

記事を読む

no image

【android】アプリ内課金を実装する

アプリ内課金のサンプルコードを解析します。 参考URL 公式API Android

記事を読む

no image

[android] ActivityとFragmentのライフサイクルいろいろ

Fragmentを使い始めてライフサイクル関係でハマることがあったので備忘録。 FragmentA

記事を読む

no image

【android】任意のスレッドで処理を行う

非UIスレッドでUIを操作したい場合に、任意の処理をUIスレッド上で実行する。 目次

記事を読む

Message

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

no image
知らないと損をする6つのライセンスまとめ

オープンソースやフリーウェア、フリー素材などが巷に溢れ、それらを利用す

no image
ガリレオ:ニュースブラウザをリリースしました。

概要 ガリレオはニュースを読んだり、検索する機能に特化したブラウザア

no image
【android】Activityとプロセスのライフサイクル

またもやライフサイクル周りでハマったのですが、Androidのライフサ

→もっと見る

PAGE TOP ↑