imageView から別のアクティビティに画像を送信する際に問題があります。私のコードはうまく機能しますが、コードで指定された画像を変更せずに送信するためだけです。写真にフィルターを追加し、この変更で画像を送信する必要があります。これは私のコードです:
最初のアクティビティ:
public void send(View view) {
//trzeba tu coś wymyslić żeby dodawało np tag żeby wiedziec jaka obraz ma nazwe
//i wstawić do tego niżej
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.i);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
Intent intent = new Intent(this, TwoActivity.class);
intent.putExtra("picture", b);
startActivity(intent);
}
次のアクティビティ:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
Bundle extras = getIntent().getExtras();
byte[] b = extras.getByteArray("picture");
Bitmap bmp = BitmapFactory.decodeByteArray(b, 0, b.length);
ImageView image = (ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(bmp);
}
変更のある画像を正しく送信するには、何を変更すればよいか教えてください。