ColorPickerDialogを使う [Dialog]
標準に用意されていないので、APIDemoにあるcom.example.android.apis.graphics.ColorPickerDialog を使います。
まず、ColorPickerDialog.java を自分のプログラムの任意のパッケージにコピーしてから。
ColorPickerDialog colorPickerDialog = new ColorPickerDialog( MainActivity.this, new ColorPickerDialog.OnColorChangedListener() { @Override public void colorChanged(int color) { //colorが選択された色 } }, Color.BLACK); colorPickerDialog.show();
【送料無料】ゼロからのAndroidアプリケ-ション開発入門
- ショップ: 楽天ブックス
ギャラリーから画像を取得する [Intent]
//呼び出す時
private static final int REQUEST_CODE_GALLERY = 99; Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, REQUEST_CODE_GALLERY);
//受け取る時
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) return; switch (requestCode) { case REQUEST_CODE_GALLERY: try { InputStream in = getContentResolver().openInputStream( data.getData()); Bitmap bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (Exception e) { } break; default: break; } }
オススメ♪スピード発送★ご購入は今すぐ★超美品■SO-03C XPERIA ray■ゴールド■docomo■携帯電話■白ロム
- ショップ: デジタル家電の王様@デジキング