my little App causes a crash when I try to set the Pixels of an Bitmap loaded by the photopicker intent and I cant figure out why. For the intent I took this code.
So here is the important part of my current code:
public class MainActivity extends AppCompatActivity {
private Bitmap selectedImage;
...
private void changebitmap() {
ImageView imageView = findViewById(R.id.imageView);
for(int x = 0; x < selectedImage.getWidth(); x++) {
for(int y = 0; y < selectedImage.getHeight(); y++) {
selectedImage.setPixel(x, y, Color.argb(255, 128, 128 ,128));
}
}
imageView.setImageBitmap(selectedImage);
}
}
I can't figure out why it won't work.
Regards