私は1つのクラスにimageViewを持っています.imageViewをクリックすると、カメラから画像を取得するか、デバイスの画像ギャラリーを開くための2つのオプションがあるダイアログボックスが表示されます。ImageView に表示できるように、あるクラスから別のクラスに画像を送信したいと考えています。私は何時間も検索していますが、あるクラスから別のクラスにテキストデータを送信することしかできませんでした。あるクラスから別のクラスに画像を送信することについて誰か教えてもらえますか?
これは、画像を取得する送信者クラスのコードです。
takeImg.setOnTouchListener(新しいOnTouchListener() { public boolean onTouch(View v, MotionEvent event) { // TODO 自動生成メソッド スタブ if(event.getAction() == event.ACTION_UP) { i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i,cameraData); } true を返します。 } }); } protected void onActivityResult(int requestCode, int resultCode, インテント データ) { // TODO 自動生成メソッド スタブ super.onActivityResult(requestCode, resultCode, data); if(resultCode==RESULT_OK) { Bundle extras=data.getExtras(); bmp=(ビットマップ)extras.get("データ"); } }
助けてくれてありがとう